-
Notifications
You must be signed in to change notification settings - Fork 115
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 #105
base: master
Are you sure you want to change the base?
homework #105
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.
Nice work, респект за потоковую обработку и понимание что индексы тут не помогут, а в чём-то могут и помешать
# frozen_string_literal: true | ||
|
||
require 'oj' | ||
class ReloadJson |
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.
- за отдельный класс
</ul> | ||
<%= render "delimiter" %> | ||
<% end %> | ||
<%= render partial: 'trip', collection: @trips, as: :trip %> |
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.
Есть ещё забавная возможность задать разделитель параметром: https://guides.rubyonrails.org/layouts_and_rendering.html#spacer-templates
После оптимизации обработак medium файла - ~ 1 сек, память - 87 MB | ||
|
||
Обработка large.json - ~ 7.6 сек, память - 87MB | ||
|
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.
💪 💪 💪 💪 respect
# Б. Отображение расписаний | ||
Начну с rack-mini-profiler | ||
|
||
Без профилировщика страница с 1004 трипов загружается за 3.4 секунды, с профилировщиком - 19 сек |
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.
надо всегда разделять профилирование отдельно - замеры отдельно
 | ||
Общее время запроса в среднем 315ms | ||
|
||
Считаю на этом можно остановиться, т.к. улучшение запросов почти не принесет пользы, а импорты могут замедлиться из-за добавления индексов |
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.
В принципе да
Тут забавно, что pg_hero может подсказать какие индексы надо добавить.
С точки зрения рендеринга страницы это ничего не даст. Но если бы мы смотрели с точки зрения нагрузки на БД, это была бы оптимизация №1
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.
Я все равно в pg_hero заглянул и проверил будет ли ругаться - вся панель была зеленая, 0 problems, видимо, suggest'ы по индексам при привышении какого-то лимита по времени только появляются
No description provided.