Skip to content

Commit

Permalink
Update the documentation for v1.0.0
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
martinthenth committed Sep 10, 2024
1 parent 6d32c55 commit f0eb2dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 27.0.1
elixir 1.17.2-otp-27
elixir 1.17.2-otp-27
45 changes: 20 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# UUIDv7

A UUID v7 implementation and `Ecto.Type` for Elixir. The RFC for the version 7 UUID: [RFC 9562](https://datatracker.ietf.org/doc/rfc9562/). This library includes an `Ecto.Type` to (auto-)generate version 7 UUIDs in `Ecto.Schema` and beyond.
A UUID v7 implementation and `Ecto.Type` for Elixir.

The RFC for the version 7 UUID: [RFC 9562](https://datatracker.ietf.org/doc/rfc9562/).

This library includes an `Ecto.Type` to (auto-)generate version 7 UUIDs in `Ecto.Schema` and beyond.

## Installation

Expand Down Expand Up @@ -31,8 +35,9 @@ Operating System: macOS
CPU Information: Apple M2 Pro
Number of Available Cores: 10
Available memory: 16 GB
Elixir 1.14.2
Erlang 25.1.2
Elixir 1.17.2
Erlang 27.0.1
JIT enabled: true

Benchmark suite executing with the following configuration:
warmup: 5 s
Expand All @@ -43,35 +48,25 @@ parallel: 1
inputs: none specified
Estimated total run time: 1 min

Benchmarking ecto (uuid v4) ...
Benchmarking uniq (uuid v7) ...
Benchmarking uuidv7 ...

Name ips average deviation median 99th %
uuidv7 1.75 M 570.22 ns ±3940.19% 500 ns 667 ns
uniq (uuid v7) 1.07 M 937.20 ns ±1852.78% 916 ns 1000 ns
ecto (uuid v4) 1.02 M 978.17 ns ±1593.54% 958 ns 1042 ns
uuidv7 1.82 M 550.49 ns ±15102.40% 417 ns 1291 ns
uniq (uuid v7) 1.80 M 554.54 ns ±19362.74% 417 ns 1292 ns
ecto (uuid v4) 1.72 M 579.75 ns ±12640.39% 458 ns 1208 ns

Comparison:
uuidv7 1.75 M
uniq (uuid v7) 1.07 M - 1.64x slower +366.98 ns
ecto (uuid v4) 1.02 M - 1.72x slower +407.95 ns
uuidv7 1.82 M
uniq (uuid v7) 1.80 M - 1.01x slower +4.05 ns
ecto (uuid v4) 1.72 M - 1.05x slower +29.25 ns

Memory usage statistics:

Name average deviation median 99th %
uuidv7 104 B ±0.00% 104 B 104 B
uniq (uuid v7) 214.00 B ±2.47% 216 B 216 B
ecto (uuid v4) 214.00 B ±2.47% 216 B 216 B
uuidv7 237.99 B ±2.23% 240 B 240 B
uniq (uuid v7) 214.01 B ±2.47% 216 B 216 B
ecto (uuid v4) 214.01 B ±2.47% 216 B 216 B

Comparison:
uuidv7 104 B
uniq (uuid v7) 214.00 B - 2.06x memory usage +110.00 B
ecto (uuid v4) 214.00 B - 2.06x memory usage +110.00 B
uuidv7 240 B
uniq (uuid v7) 214.01 B - 0.90x memory usage -23.98508 B
ecto (uuid v4) 214.01 B - 0.90x memory usage -23.98596 B
```

## Credits

This library is based on the Rust library [UUID](https://crates.io/crates/uuid). Thank you!

The `Ecto.Type` is heavily borrowed from from [Ecto](https://github.com/elixir-ecto/ecto). Thanks!
8 changes: 6 additions & 2 deletions lib/uuidv7.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
defmodule UUIDv7 do
@moduledoc """
A UUID v7 implementation and `Ecto.Type` for Elixir
A UUID v7 implementation and `Ecto.Type` for Elixir.
The RFC for the version 7 UUID: [RFC 9562](https://datatracker.ietf.org/doc/rfc9562/).
This library includes an `Ecto.Type` to (auto-)generate version 7 UUIDs in `Ecto.Schema` and beyond.
## Installation
The package can be installed by adding `uuidv7` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:uuidv7, "~> 0.2"}]
[{:uuidv7, "~> 1.0"}]
end
```
Expand Down

0 comments on commit f0eb2dd

Please sign in to comment.