Skip to content
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

Speed up digest with recursive hash #320

Merged
merged 1 commit into from Jun 21, 2016
Merged

Conversation

schneems
Copy link
Member

@schneems schneems commented Jun 20, 2016

Digest is the second most time spent while compiling assets in the un-cached asset compilation case 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 for CodeTriage.com

@schneems
Copy link
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.
@heliocola
Copy link
Contributor

@schneems I am on it.

@schneems schneems merged commit ab6b0a5 into master Jun 21, 2016
@heliocola
Copy link
Contributor

@schneems I disabled the comments in the codacy tool.
Sorry about the inconvenience.

@rafaelfranca
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants