Open
Conversation
spajic
approved these changes
Feb 23, 2025
| Я решил исправить эту проблему, оптимизировав эту программу. | ||
|
|
||
| ## Формирование метрики | ||
| Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику: проверка использования памяти на файле с меньшим количество строк (40000 строк). |
Collaborator
There was a problem hiding this comment.
Сорри за духоту, но это не метрика; метрика это число какое-то, которое характеризует вашу систему
| - memory_profiler показал, что split строк файла занимает 18.95 MB | ||
| - как вы решили её оптимизировать - было решено переделать и написать в "потоковом" стиле | ||
| - как изменилась метрика: память уменьшилась с 98.00 MB до 15 MB | ||
| - как изменился отчёт профилировщика - обработка строк большого файла теперь занимает 15 MB и 27,47 секунд. |
Collaborator
There was a problem hiding this comment.
самый кайф, что на тех же 15МБ можно любой объём данных перелопатить
| ### Ваша находка №4 | ||
| - memory_profiler показал, что получение "Даты сессий через запятую в обратном порядке в формате" занимает 30.83 MB MB | ||
| - как вы решили её оптимизировать - решил упростить получение дат сессий | ||
| - как изменилась метрика: память уменьшилась с 127.15 MB MB до 98.00 MB |
Collaborator
There was a problem hiding this comment.
сорри за духоту, но тут лучше уточнить формулировки; "память уменьшилась" звучит не очень конкретно
|
|
||
| def write_user(user, stream_writer) | ||
| stream_writer.push_key("#{user.first_name} #{user.last_name}") | ||
| stream_writer.push_object |
|
|
||
| ### Ваша находка №5 | ||
| - memory_profiler показал, что split строк файла занимает 18.95 MB | ||
| - как вы решили её оптимизировать - было решено переделать и написать в "потоковом" стиле |
Collaborator
There was a problem hiding this comment.
хорошо, что сделали несколько итераций до этого, польза++
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.