-
Notifications
You must be signed in to change notification settings - Fork 134
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вывод не понятен
|
||
## Результаты | ||
В результате проделанной оптимизации наконец удалось обработать файл с данными. | ||
Однако здесь с профилировщиками возникла проблема - на одном и том же файле они показывают разные результаты: |
There was a problem hiding this comment.
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| |
There was a problem hiding this comment.
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| |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)
No description provided.