Conversation
spajic
approved these changes
Feb 17, 2025
| * [2025-02-12 22:53:59 +0400] Memory usage: 255.00 MB | ||
| * [2025-02-12 22:54:01 +0400] Memory usage: 281.00 MB | ||
| * [2025-02-12 22:54:03 +0400] Memory usage: 304.00 MB | ||
| * [2025-02-12 22:54:05 +0400] Memory usage: 334.00 MB |
Collaborator
There was a problem hiding this comment.
вот, сразу всё видно - 22МБ чисто для старта; потом заргузка файла; потом плавный рост со временем
| То же самое проделываю и с предыдущей строкой. | ||
| - Метрика уменьшилась на 54 Мб на 50_000 срок | ||
| {"3.3.6":{"gc":"enabled","time":14.16,"gc_count":128,"memory":"215 MB"}} | ||
| Кратно уменьшилось количество срабатываний gc |
| Избавился от Date.parse, он также не нужен. | ||
|
|
||
| Добавил # frozen_string_literal: true | ||
| - Количество потребляемой памяти уменьшилось на 160MB на 50_000 строк |
Collaborator
There was a problem hiding this comment.
да, но непонятно что как сработало из-за того что объединили много изменений в один шаг
| Гигантскую долю памяти удалось сэкономить преписав программу в потоковом стиле с помощью гема Oj. | ||
|
|
||
| *Какими ещё результами можете поделиться* | ||
| Кажется для более точной оценки потребления памяти необходимо учитывать память которая была выделена |
Collaborator
There was a problem hiding this comment.
нам не так важно обычно сколько именно было добавлено дополнительно; важно в результате просто сколько процесс потребляет (например чтобы в лимиты в k8s вписываться)
| # frozen_string_literal: true | ||
|
|
||
| class MemoryReporter | ||
| DEFAULT_LIMIT_MB = 700 |
|
|
||
| it 'consumes no more than 70 MB of memory' do | ||
| expect { work('data_large.txt', 'result.json') } | ||
| .to perform_allocation(70_000_000).bytes |
Collaborator
There was a problem hiding this comment.
perform_allocation это не то; нам надо MAX RSS оценить, а не кол-во аллокаций и не объём выделенной памяти
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.