-
Notifications
You must be signed in to change notification settings - Fork 140
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
Memory optimization #125
base: master
Are you sure you want to change the base?
Memory optimization #125
Conversation
0e634d2
to
5448a93
Compare
5448a93
to
96988a1
Compare
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.
nice work! ✅
- gem memory_profiler | ||
- gem ruby-prof и отчеты callstack & qcachegrind | ||
- gem stackprof + CLI и Speedscope | ||
- второй thread для мониторинга памяти |
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.
👍
cols = line.split(',') | ||
``` | ||
- memory_profiler | ||
- Вместо разделения строки на части с помощью split и проверки первого элемента, я решил использовать метод start_with? |
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.
👍 clever move; можно даже по первой букве определить тип строки
') | ||
def work(file_path = 'data.txt', memory_watcher = false) | ||
if memory_watcher | ||
memory_watcher = MemoryWatcher.new(70) |
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.
👍
users_objects = users_objects + [user_object] | ||
``` | ||
- memory_profiler | ||
- Вместо оператора + было применено использование метода <<, который добавляет элемент в существующий массив без создания нового объекта. |
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.
nice work, like что не стали сразу все << во всех местах в один шаг объединять
No description provided.