-
Notifications
You must be signed in to change notification settings - Fork 236
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
Code optimization: 30% speedup #6
Merged
Merged
Commits on Aug 13, 2011
-
Configuration menu - View commit details
-
Copy full SHA for a5045f4 - Browse repository at this point
Copy the full SHA a5045f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 85679c2 - Browse repository at this point
Copy the full SHA 85679c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e3da6d - Browse repository at this point
Copy the full SHA 6e3da6dView commit details -
Configuration menu - View commit details
-
Copy full SHA for cc08a17 - Browse repository at this point
Copy the full SHA cc08a17View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1216a92 - Browse repository at this point
Copy the full SHA 1216a92View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0fa9eab - Browse repository at this point
Copy the full SHA 0fa9eabView commit details -
Configuration menu - View commit details
-
Copy full SHA for 65cebad - Browse repository at this point
Copy the full SHA 65cebadView commit details -
Configuration menu - View commit details
-
Copy full SHA for fad9406 - Browse repository at this point
Copy the full SHA fad9406View commit details -
Configuration menu - View commit details
-
Copy full SHA for a19cea7 - Browse repository at this point
Copy the full SHA a19cea7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d012c8 - Browse repository at this point
Copy the full SHA 2d012c8View commit details -
Use pre-made Procs instead of long case/when construct
Code such as case mask_pattern when QRMASKPATTERN[:pattern000] (i + j) % 2 == 0 when QRMASKPATTERN[:pattern001] i % 2 == 0 when QRMASKPATTERN[:pattern010] j % 3 == 0 is very slow because it requires an `Hash#[]` lookup and a `Kernel#===` call for every branch of the `case` construct, 3.5 * 2 function calls on average. We exploit the fact that `mask_pattern` is a Fixnum and pre-populate an array of possible computations. This takes exactly one `Array#[]` lookup and `Proc#call` execution per mask pattern.
Configuration menu - View commit details
-
Copy full SHA for 293580b - Browse repository at this point
Copy the full SHA 293580bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5eabc76 - Browse repository at this point
Copy the full SHA 5eabc76View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b7fa53 - Browse repository at this point
Copy the full SHA 9b7fa53View commit details -
Configuration menu - View commit details
-
Copy full SHA for 84ff757 - Browse repository at this point
Copy the full SHA 84ff757View commit details -
Configuration menu - View commit details
-
Copy full SHA for ab7e5dc - Browse repository at this point
Copy the full SHA ab7e5dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1c42501 - Browse repository at this point
Copy the full SHA 1c42501View commit details -
Configuration menu - View commit details
-
Copy full SHA for 06ccf4a - Browse repository at this point
Copy the full SHA 06ccf4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 37b014b - Browse repository at this point
Copy the full SHA 37b014bView commit details -
Configuration menu - View commit details
-
Copy full SHA for f56c29a - Browse repository at this point
Copy the full SHA f56c29aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 52c9caf - Browse repository at this point
Copy the full SHA 52c9cafView commit details
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.