Skip to content

Commit

Permalink
Add comparison benchmark to uniq
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwinchester committed Apr 19, 2024
1 parent 265c67e commit 11752d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bench/compare.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
alias UUIDv7.Clock

{:ok, _pid} = Clock.start_link([])

Benchee.run(%{
"uuid_v7 raw" => fn ->
UUIDv7.bingenerate()
end,
"uuid_v7 string" => fn ->
UUIDv7.generate()
end,
"uniq v7 raw" => fn ->
Uniq.UUID.uuid7(:raw)
end,
"uniq v7 string" => fn ->
Uniq.UUID.uuid7(:default)
end
})
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ defmodule UUIDv7.MixProject do
defp deps do
[
{:ecto, "~> 3.0", optional: true},
{:uniq, "~> 0.1", only: [:bench], runtime: false},
{:benchee, "~> 1.0", only: [:bench], runtime: false},
{:ex_doc, "~> 0.31", only: [:dev], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"uniq": {:hex, :uniq, "0.6.1", "369660ecbc19051be526df3aa85dc393af5f61f45209bce2fa6d7adb051ae03c", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "6426c34d677054b3056947125b22e0daafd10367b85f349e24ac60f44effb916"},
}

0 comments on commit 11752d8

Please sign in to comment.