Open
Conversation
spajic
approved these changes
Apr 2, 2019
Owner
spajic
left a comment
There was a problem hiding this comment.
Very nice case-study! Thank you for your work!
| On the other hand, `#each` method is called 25408 time and most of the time is spent in this method's children. | ||
|
|
||
| Based on the `GraphHtmlPrinter` report we observe same results, | ||
| where starting from line 100 there is a memory consuming code: |
|
|
||
| Just based on the above reports we can see that processing file was much faster after this refactoring. | ||
|
|
||
| #### Redults from RubyProf::FlatProfiler |
| ### Discovery №2 | ||
| О вашей находке №2 | ||
|
|
||
| For getting unique values we can use `Set` class. |
|
|
||
| and use `Set` during reading each line of file: | ||
| ``` | ||
| unique_browsers = Set.new([]) |
Owner
There was a problem hiding this comment.
You can also make use of SortedSet in this task.
| b.include?(CHROME) #CHROME is a Constant | ||
| ``` | ||
|
|
||
| Also used `oj` gem to parse json based on this comparison gist I found https://gist.github.com/aishfenton/480059. |
|
|
||
| ## Protection against performance regression | ||
|
|
||
| I added minitest to check that processing time of 1Mb file would not exceed 0.3 seconds |
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.
No description provided.