Speed up digest with recursive hash#320
Merged
Merged
Conversation
Member
Author
|
@heliocola please find a way to turn this @codacy-bot commenting off and delete these messages. Alternative is to block that user from this org |
Digest is the second most time spent while compiling assets on the first run for CodeTriage. The `if/elsif` means that for complex data structures many many comparisons are made. Instead we store the logic of digesting each class in a hash with the class name as a key. Complex data types digest themselves by recursively calling into the hash. Is it faster? On CodeTriage.com over 50 runs against this codebase and master it averaged 12.54s per run on this branch stdev 0.27seconds and against master it was 14.9s with a 2.045 stdev. So in the average case it makes asset generation 16% faster.
3f0f651 to
94a1207
Compare
Contributor
|
@schneems I am on it. |
Contributor
|
@schneems I disabled the comments in the codacy tool. |
Member
|
👍 |
This was referenced Mar 15, 2021
This file contains hidden or 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
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.
Digest is the second most time spent while compiling assets in the un-cached asset compilation case for CodeTriage. The
if/elsifmeans that for complex data structures many many comparisons are made. Instead we store the logic of digesting each class in a hash with the class name as a key. Complex data types digest themselves by recursively calling into the hash.Is it faster?
On CodeTriage.com over 50 runs against this codebase and master it averaged 12.54s per run on this branch stdev 0.27seconds and against master it was 14.9s with a 2.045 stdev. So in the average case it makes asset generation 16% faster for CodeTriage.com