-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use Array#shift
instead of Array#slice!
to improve performance
#69
Merged
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
…rray pop/shift/slice benchmarks
```diff -Benchmarks for rambling-trie version 2.5.0 +Benchmarks for rambling-trie version 2.5.1 ==> Creation - `Rambling::Trie.create` 5 iterations - - 5.166490 0.132087 5.298577 ( 5.333874) + 5.181516 0.113003 5.294519 ( 5.296937) ==> Compression - `compress!` 5 iterations - - 3.418139 0.379451 3.797590 ( 3.800981) + 3.407729 0.266162 3.673891 ( 3.681826) ==> Serialization (raw trie) - `Rambling::Trie.load` 5 iterations - - 2.309660 0.070745 2.380405 ( 2.381282) + 2.391843 0.091314 2.483157 ( 2.485032) ==> Serialization (compressed trie) - `Rambling::Trie.load` 5 iterations - - 1.279938 0.026883 1.306821 ( 1.307595) + 1.333040 0.034955 1.367995 ( 1.368192) ==> Lookups (raw trie) - `word?` 200000 iterations - hi true - 0.380980 0.003259 0.384239 ( 0.384605) + 0.292980 0.004823 0.297803 ( 0.297856) 200000 iterations - help true - 0.456881 0.001888 0.458769 ( 0.459821) + 0.331650 0.004004 0.335654 ( 0.335843) 200000 iterations - beautiful true - 0.943306 0.003466 0.946772 ( 0.947187) + 0.668538 0.002521 0.671059 ( 0.671363) 200000 iterations - impressionism true - 1.324680 0.003980 1.328660 ( 1.329083) + 0.947736 0.005760 0.953496 ( 0.959066) 200000 iterations - anthropological true - 1.521681 0.004749 1.526430 ( 1.528687) + 1.079792 0.005359 1.085151 ( 1.086156) ==> Lookups (compressed trie) - `word?` 200000 iterations - hi true - 0.485533 0.001283 0.486816 ( 0.486854) + 0.411832 0.014980 0.426812 ( 0.427248) 200000 iterations - help true - 0.741451 0.001625 0.743076 ( 0.743270) + 0.452406 0.004271 0.456677 ( 0.457017) 200000 iterations - beautiful true - 1.505587 0.004699 1.510286 ( 1.510880) + 0.914679 0.004376 0.919055 ( 0.919563) 200000 iterations - impressionism true - 2.126592 0.008310 2.134902 ( 2.136511) + 1.227487 0.004293 1.231780 ( 1.232426) 200000 iterations - anthropological true - 2.193555 0.006924 2.200479 ( 2.201894) + 1.309019 0.005509 1.314528 ( 1.316368) ==> Lookups (raw trie) - `partial_word?` 200000 iterations - hi true - 0.453775 0.032336 0.486111 ( 0.486380) + 0.198933 0.003294 0.202227 ( 0.202253) 200000 iterations - help true - 0.321361 0.011719 0.333080 ( 0.333259) + 0.234788 0.000753 0.235541 ( 0.235567) 200000 iterations - beautiful true - 0.559013 0.009736 0.568749 ( 0.569840) + 0.480295 0.001457 0.481752 ( 0.481775) 200000 iterations - impressionism true - 0.744356 0.003031 0.747387 ( 0.747801) + 0.666240 0.002132 0.668372 ( 0.668457) 200000 iterations - anthropological true - 0.840434 0.003103 0.843537 ( 0.844030) + 0.752458 0.002421 0.754879 ( 0.755093) ==> Lookups (compressed trie) - `partial_word?` 200000 iterations - hi true - 0.433414 0.008848 0.442262 ( 0.442261) + 0.513155 0.009965 0.523120 ( 0.524930) 200000 iterations - help true - 0.615922 0.002208 0.618130 ( 0.618272) + 0.775981 0.003057 0.779038 ( 0.779575) 200000 iterations - beautiful true - 1.207464 0.004935 1.212399 ( 1.212535) + 1.522400 0.006167 1.528567 ( 1.528934) 200000 iterations - impressionism true - 1.644064 0.008506 1.652570 ( 1.653030) + 2.104026 0.009074 2.113100 ( 2.114493) 200000 iterations - anthropological true - 1.571636 0.006507 1.578143 ( 1.578509) + 2.032133 0.010093 2.042226 ( 2.043451) ==> Lookups (raw trie) - `scan` 1000 iterations - hi 495 - 2.153751 0.008441 2.162192 ( 2.163107) + 1.551896 0.006708 1.558604 ( 1.558730) 100000 iterations - help 20 - 8.035161 0.028510 8.063671 ( 8.071168) + 5.955445 0.035683 5.991128 ( 6.001368) 100000 iterations - beautiful 6 - 3.356202 0.015116 3.371318 ( 3.373237) + 2.436855 0.010703 2.447558 ( 2.448266) 200000 iterations - impressionism 2 - 2.997617 0.011874 3.009491 ( 3.010877) + 2.150687 0.011139 2.161826 ( 2.163904) 200000 iterations - anthropological 2 - 3.425885 0.016300 3.442185 ( 3.443657) + 2.494487 0.011573 2.506060 ( 2.509176) ==> Lookups (compressed trie) - `scan` 1000 iterations - hi 495 - 1.337273 0.006939 1.344212 ( 1.346258) + 1.176379 0.005506 1.181885 ( 1.182752) 100000 iterations - help 20 - 4.830496 0.031682 4.862178 ( 4.881905) + 4.243129 0.017393 4.260522 ( 4.261604) 100000 iterations - beautiful 6 - 2.649202 0.019041 2.668243 ( 2.682832) + 2.240909 0.009512 2.250421 ( 2.251232) 200000 iterations - impressionism 2 - 3.402142 0.027368 3.429510 ( 3.475814) + 2.848701 0.012397 2.861098 ( 2.862355) 200000 iterations - anthropological 2 - 3.220636 0.040881 3.261517 ( 3.319977) + 2.697671 0.011099 2.708770 ( 2.709960) ==> Lookups (raw trie) - `words_within` 100000 iterations - ifdxawesome45someword319 - 6.302864 0.058079 6.360943 ( 6.394920) + 5.677077 0.026624 5.703701 ( 5.717893) 100000 iterations - ifdx45someword3awesome19 - 6.099609 0.056451 6.156060 ( 6.179574) + 5.668625 0.037222 5.705847 ( 5.748438) ==> Lookups (compressed trie) - `words_within` 100000 iterations - ifdxawesome45someword319 - 12.834169 0.060509 12.894678 ( 12.902920) + 11.150452 0.054609 11.205061 ( 11.212023) 100000 iterations - ifdx45someword3awesome19 - 12.618141 0.055584 12.673725 ( 12.691873) + 10.986602 0.053572 11.040174 ( 11.061771) ```
gonzedge
force-pushed
the
gonzedge/slice-shift
branch
from
November 30, 2024 23:36
d0358a7
to
5f3ee34
Compare
Code Climate has analyzed commit db6a9ed and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (95% is the threshold). This pull request will bring the total coverage in the repository to 100.0% (0.0% change). View more on Code Climate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See all
Lookups
in benchmark diff below be significantly faster!