HW2#55
Open
Arshev wants to merge 5 commits intohardcode-dev:masterfrom
Open
Conversation
spajic
approved these changes
May 7, 2021
Collaborator
spajic
left a comment
There was a problem hiding this comment.
✅ Хорошая работа и спасибо за находку!
| Я решил исправить эту проблему, оптимизировав эту программу. | ||
|
|
||
| ## Формирование метрики | ||
| Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: оперативная память |
Collaborator
There was a problem hiding this comment.
оперативная память измеренная как и в какой момент?
| ## Результаты | ||
| В результате проделанной оптимизации наконец удалось обработать файл с данными. | ||
| Удалось улучшить метрику системы с 441.91 MB до 5.83 MB и уложиться в заданный бюджет. Так же удалось довести время выполнения до заданных 30 сек. | ||
| xquartz запустить не удалось, может на big sur не идет. Однако, был найден онлайн аналог http://boutglay.com/massifjs/ который почему то не запускается с русского ip, но мы и не таких видали, поэтому скриншоты прилагаю. В итоге, удалось снизить постребление памяти до ~38,6 MB. |
Collaborator
There was a problem hiding this comment.
Спасибо за находку 👍
Это удобнее
| report[:allBrowsers].add(item.upcase!) | ||
| report[:uniqueBrowsersCount].add(item) | ||
| users_stats[:browsers] << item | ||
| users_stats[:usedIE] ||= item.match?(/INTERNET EXPLORER/) |
Collaborator
There was a problem hiding this comment.
Полагаю так постоянно создаются эти регекспы
Можно было бы регексп в константу, а саму проверку в именованный метод
| users_stats[:alwaysUsedChrome] &&= item.match?(/CHROME/) | ||
| when 4 | ||
| users_stats[:totalTime] += item.to_i | ||
| users_stats[:longestSession] = item.to_i if users_stats[:longestSession] < item.to_i |
Collaborator
There was a problem hiding this comment.
три раза создаём число через item.to_i
| users_objects = users_objects + [user_object] | ||
| end | ||
| report[:uniqueBrowsersCount] = report[:uniqueBrowsersCount].size | ||
| report[:allBrowsers] = report[:allBrowsers].sort.join(',') |
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.