ryanwinchester / uuidv7

UUIDv7 for Elixir (and Ecto)
MIT License
34 stars 3 forks source link

Check `:ets` table options to answer a few questions #4

Closed ryanwinchester closed 7 months ago

ryanwinchester commented 7 months ago

I have several unanswered questions, here are two of them I can think of at the moment:

  1. Do read_concurrency and/or write_concurrency work with :ets.update_counter/4 at all?
  2. Would using :ordered_set make any difference one way or another?
ryanwinchester commented 7 months ago

https://github.com/ryanwinchester/uuidv7/tree/main/bench

Name                             ips        average  deviation         median         99th %
set_read                      2.68 M      373.12 ns  ±4834.26%         333 ns         459 ns
set                           2.68 M      373.38 ns  ±4868.25%         333 ns         459 ns
set_read_write                2.65 M      377.17 ns  ±4917.84%         333 ns         500 ns
set_write                     2.64 M      378.25 ns  ±4858.28%         333 ns         500 ns
ordered_set                   2.50 M      400.31 ns  ±4576.03%         334 ns         500 ns
ordered_set_read              2.48 M      402.95 ns  ±4776.72%         334 ns         500 ns
ordered_set_write             2.41 M      415.16 ns  ±4304.95%         375 ns         542 ns
ordered_set_read_write        2.40 M      415.80 ns  ±4499.65%         375 ns         542 ns

Comparison:
set_read                      2.68 M
set                           2.68 M - 1.00x slower +0.26 ns
set_read_write                2.65 M - 1.01x slower +4.05 ns
set_write                     2.64 M - 1.01x slower +5.13 ns
ordered_set                   2.50 M - 1.07x slower +27.19 ns
ordered_set_read              2.48 M - 1.08x slower +29.83 ns
ordered_set_write             2.41 M - 1.11x slower +42.05 ns
ordered_set_read_write        2.40 M - 1.11x slower +42.68 ns