-
Notifications
You must be signed in to change notification settings - Fork 2
Benchmark
Kenichi Kamiya edited this page Jul 17, 2022
·
12 revisions
There is some benchmarks
$ rake --tasks | grep 'benchmark'
rake benchmark/core_instance_methods.rb # Rough benchmark for core_instance_methods.rb
rake benchmark/extra_instance_methods.rb # Rough benchmark for extra_instance_methods.rb
rake benchmark/generators.rb # Rough benchmark for generators.rb
rake benchmark/sample.rb # Rough benchmark for sample.rb
rake benchmark/sort.rb # Rough benchmark for sort.rb
rake benchmark_with_other_gems # Compare generating String performance with other gems
This runs rough benchmarks
$ rake benchmark_with_other_gems
(Do not use `bundle exec`!)
One of the result at 0.6.0.pre - 2022/07/18 on my machine
See #213 for further detail
❯ rake benchmark_with_other_gems
------------------------------------------------------------------------
#### kachick - ruby-ulid(This one)
cd ./benchmark/compare_with_othergems/kachick
bundle install --quiet
bundle exec ruby -v ./generate.rb
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Warming up --------------------------------------
ULID.encode 12.363k i/100ms
Calculating -------------------------------------
ULID.encode 119.758k (±14.3%) i/s - 593.424k in 5.071896s
"`ruby-ulid gem (this one) - 0.6.0.pre` generated products: 832041 - sample: [\"01G86TFTMSMAYPX24J3NWBYB3N\", \"01G86TFW3TS0YSNR3RY6E5SRDF\", \"01G86TFSH3YM4FCQB5W4VARCZV\", \"01G86TFX92QKAJXC3ADCA1J662\", \"01G86TFV0QYWNKD2NHH88YW57H\"]"
cd -
------------------------------------------------------------------------
#### rafaelsales - ulid
cd ./benchmark/compare_with_othergems/rafaelsales
bundle install --quiet
bundle exec ruby -v ./generate.rb
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Warming up --------------------------------------
ULID.generate 9.128k i/100ms
Calculating -------------------------------------
ULID.generate 82.906k (±11.0%) i/s - 410.760k in 5.026247s
"`ulid gem - 1.3.0` generated products: 585831 - sample: [\"01G86TG68FGBY0VCGENC9YC3NT\", \"01G86TG6A788TJQ8BB29MQYS2Q\", \"01G86TG7JNWXWP5G1NDSS8K00J\", \"01G86TG54JVTPN4ZNNWQYCVVEE\", \"01G86TG3S0RPSMRM1EYGPDJX9D\"]"
cd -
------------------------------------------------------------------------
#### abachman - ulid-ruby
cd ./benchmark/compare_with_othergems/abachman
bundle install --quiet
bundle exec ruby -v ./generate.rb
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Warming up --------------------------------------
ULID.generate 7.454k i/100ms
Calculating -------------------------------------
ULID.generate 67.697k (±10.4%) i/s - 335.430k in 5.011842s
"`ulid-ruby gem - 1.0.2` generated products: 475505 - sample: [\"01G86TGA3T4HWA3MR4YDQSS4NV\", \"01G86TGE7BZJMDKPDMJCH9F00X\", \"01G86TGAA4414FF9GG1AV2M8HX\", \"01G86TGFKZXWFP06XAMW5V57Q5\", \"01G86TGAFER6BH0Q3DVJW5EAWD\"]"
cd -
This gem does not aim faster than others
. However it works faster! ⚡