Task 1#78
Open
romankirpichnikov wants to merge 1 commit intohardcode-dev:masterfrom
Open
Conversation
spajic
approved these changes
May 6, 2021
| @@ -0,0 +1 @@ | |||
| require: rubocop-performance | |||
| 36.74 0.168 0.167 0.000 0.001 15000 Array#all? | ||
| ``` | ||
|
|
||
| По логике программы, решил просто заменить массив на Set т.к он реализова поверх хеша с встроенной возможности определения уникальности и o(1) сложность |
| 5.57 0.016 0.016 0.000 0.000 25424 Regexp#match | ||
| ``` | ||
|
|
||
| В итоге получили еще прирост в полтора раза с Total: 0.455129 до Total: 0.289249 |
Collaborator
There was a problem hiding this comment.
уже слишком короткое время - стоило бы увеличить объём данных, чтобы программа успевала поработать в основном цикле и не так сильно влияли случайные отклонения
|
|
||
| ### Гипотеза №4 | ||
|
|
||
| Решил увеличить семпл для сбора статисики, для более наглядного отчета, но даже из предыдущего видно что парсинг даты занимает огромное количество процессерного времени. Изучив исходники понял, что можно сначала приводить даты к определенному формату `'%Y-%m-%d'` а только потом уже сортировать по iso8601. Есть другая мысль о том чтоб лишний раз не парсить данные, а агрегировать их в хеше, но вернусь к ней если еще раз упрусь в производительность Парсинга даты. |
Collaborator
There was a problem hiding this comment.
Плюсик за увеличение семпла
| 11.78 3.380 3.380 0.000 0.000 3250940 String#split | ||
| 10.40 14.176 2.984 0.000 11.193 3 Hash#each_key | ||
| 6.10 1.751 1.751 0.000 0.000 2750940 Object#parse_session | ||
| 5.17 1.484 1.484 0.000 0.000 2750940 Date#iso8601 |
Collaborator
There was a problem hiding this comment.
Дату можно было вообще не парсить на самом деле, такой подвох
| Sort by: self_time | ||
|
|
||
| %self total self wait child calls name location | ||
| 33.07 20.307 9.488 0.000 10.819 500001 Array#each |
Collaborator
There was a problem hiding this comment.
У вас в программе осталось два .each, внутри каждого большой анонимный блок кода
В результате по отчёту не особо понятно в чём собственно проблема.
Это можно преодолеть тем, чтобы выделить именованные методы
- вызывать внутри each именованные методы
- сами each завернуть в именованные методы
Тогда отчёты будут более информативны
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.