-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Experimental] Monotonic encode with less abstraction #220
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` /home/kachick/.rubies/ruby-3.1.2/bin/ruby benchmark/generate_vs_encode.rb Warming up -------------------------------------- ULID.encode 15.911k i/100ms ULID.generate.to_s 14.175k i/100ms ULID.generate 14.284k i/100ms ULID.parse(ULID.encode) 9.858k i/100ms Calculating ------------------------------------- ULID.encode 163.134k (± 2.7%) i/s - 827.372k in 5.076016s ULID.generate.to_s 142.584k (± 2.6%) i/s - 722.925k in 5.073685s ULID.generate 143.053k (± 2.2%) i/s - 728.484k in 5.094885s ULID.parse(ULID.encode) 96.058k (± 1.8%) i/s - 483.042k in 5.030270s Comparison: ULID.encode: 163134.4 i/s ULID.generate: 143053.1 i/s - 1.14x (± 0.00) slower ULID.generate.to_s: 142584.2 i/s - 1.14x (± 0.00) slower ULID.parse(ULID.encode): 96058.3 i/s - 1.70x (± 0.00) slower ```
kachick
added
enhancement
New feature or request
performance
Optimized for performance
monotonicity
labels
Jul 20, 2022
``` ruby benchmark/monotonic_generators_with_now.rb Warming up -------------------------------------- ULID.encode 16.422k i/100ms ULID::MonotonicGenerator#encode 13.716k i/100ms ULID::MonotonicGenerator#generate.to_s 12.509k i/100ms Calculating ------------------------------------- ULID.encode 159.103k (± 6.3%) i/s - 804.678k in 5.080926s ULID::MonotonicGenerator#encode 138.566k (± 0.8%) i/s - 699.516k in 5.048617s ULID::MonotonicGenerator#generate.to_s 125.773k (± 0.7%) i/s - 637.959k in 5.072585s Comparison: ULID.encode: 159102.5 i/s ULID::MonotonicGenerator#encode: 138565.6 i/s - 1.15x (± 0.00) slower ULID::MonotonicGenerator#generate.to_s: 125772.8 i/s - 1.26x (± 0.00) slower ruby benchmark/monotonic_generators_with_different_time.rb Warming up -------------------------------------- ULID.encode with different time 20.901k i/100ms ULID::MonotonicGenerator#encode with different time 17.098k i/100ms ULID::MonotonicGenerator#generate.to_s with different time 15.025k i/100ms Calculating ------------------------------------- ULID.encode with different time 206.509k (± 1.5%) i/s - 1.045M in 5.061774s ULID::MonotonicGenerator#encode with different time 170.083k (± 0.9%) i/s - 854.900k in 5.026802s ULID::MonotonicGenerator#generate.to_s with different time 147.626k (± 1.5%) i/s - 751.250k in 5.090018s Comparison: ULID.encode with different time: 206509.5 i/s ULID::MonotonicGenerator#encode with different time: 170083.3 i/s - 1.21x (± 0.00) slower ULID::MonotonicGenerator#generate.to_s with different time: 147626.3 i/s - 1.40x (± 0.00) slower ```
kachick
added a commit
that referenced
this pull request
Jul 20, 2022
kachick
added a commit
that referenced
this pull request
Jul 20, 2022
kachick
changed the title
[Experimental] Monotonic encode
[Experimental] Monotonic encode with less abstraction
Jul 20, 2022
kachick
added a commit
that referenced
this pull request
Jul 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow #213 in MonotonicGenerator