Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework 2 #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Homework 2 #124

wants to merge 3 commits into from

Conversation

alexrails
Copy link

No description provided.

Copy link
Collaborator

@spajic spajic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* [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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот, сразу всё видно - 22МБ чисто для старта; потом заргузка файла; потом плавный рост со временем

То же самое проделываю и с предыдущей строкой.
- Метрика уменьшилась на 54 Мб на 50_000 срок
{"3.3.6":{"gc":"enabled","time":14.16,"gc_count":128,"memory":"215 MB"}}
Кратно уменьшилось количество срабатываний gc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 вот это хороший инсайт

Избавился от Date.parse, он также не нужен.

Добавил # frozen_string_literal: true
- Количество потребляемой памяти уменьшилось на 160MB на 50_000 строк
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, но непонятно что как сработало из-за того что объединили много изменений в один шаг


*Какими ещё результами можете поделиться*
Кажется для более точной оценки потребления памяти необходимо учитывать память которая была выделена
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нам не так важно обычно сколько именно было добавлено дополнительно; важно в результате просто сколько процесс потребляет (например чтобы в лимиты в k8s вписываться)

# frozen_string_literal: true

class MemoryReporter
DEFAULT_LIMIT_MB = 700
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

70 же


it 'consumes no more than 70 MB of memory' do
expect { work('data_large.txt', 'result.json') }
.to perform_allocation(70_000_000).bytes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perform_allocation это не то; нам надо MAX RSS оценить, а не кол-во аллокаций и не объём выделенной памяти

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants