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 (Lutovinova) #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kseni265
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.

👍

Для того, чтобы понимать, дают ли мои изменения положительный эффект на быстродействие программы я придумал использовать такую метрику:
объем потребляемой памяти на обработке файла в 40MB.
После предварительного замера потребляемой памяти на файле размером в 40MB (1_000_000 строк) результат составил 3667 MB.
Исходя из линейного роста ограничим бюджет на уровне 23MB.
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.

При запуске memoryprofiler мы не смотрим RSS процесса (который нам и интересен)

Не смешиваем профилирование и замеры. Профилирование нам показывает где создаётся больше всего объектов / где удерживается больше всего объектов. Но MemoryProfiler хранит кучу данных в памяти и сам по себе раздувает RSI процесса. Поэтому делать замеры надо без него уже.

Valgrind у вас скорее всего нормально не заработал. Так как типичная ситуация это около 40MB на всём протяжении работы. 2МБ больше похоже на то что программа не смогла загрузиться и сразу вылетела.


reset_user_vars!

line.split(',') do |str|
Copy link
Collaborator

Choose a reason for hiding this comment

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

йее, split with block

@total_users += 1

elsif line.start_with? 'session'
line.split(',') do |str|
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@current_session_browser.upcase!

@total_sessions += 1
@total_browsers << @current_session_browser unless @total_browsers.include?(@current_session_browser)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут лучше бы Set. Проверять include по массиву долго, O(N), а по Set - O(1)

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