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

Task - 3. #85

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

Task - 3. #85

wants to merge 1 commit into from

Conversation

pochkuntaras
Copy link

No description provided.

@pochkuntaras pochkuntaras changed the title Optimize reload json and rendering page of trips. Task - 3. Jun 13, 2022
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.

Лайк, хорошая работа 👍

<%#= render trip.bus.services %>
</ul>
<% end %>
<%= '=' * 52 %>
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.

Если удалить паршлы и заинлайнить их, то рендерится быстрее конечно

Но есть возможность использовать паршлы и не убивать перформанс: рендеринг коллекций

Там можно даже шаблон делимитера задать аргументом: https://guides.rubyonrails.org/layouts_and_rendering.html#spacer-templates

nil
end

def add_item(collection, item_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice implementation 👍

s = Service.find_or_create_by(name: service)
services << s
Benchmark.bm do |x|
x.report('Clearing database') do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Очистку данных и загрузку лучше бы ещё в транзакцию завернуть

@@ -0,0 +1,176 @@
#№ Оптимизация импорта данных
Установил `gem 'annotate'` для того, что бы увидеть зависимости, поля и индексы таблиц.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Creating data 35.507971 0.369157 35.877128 ( 44.157531)
```

Из результатов видно, что мы достигли желаемого результата в бюджет в одну минуту.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍


- Из анализа запросов `rack-mini-profiler` видно, что есть проблемы с индексами таблиц.
Для анализа проблем с индексами установим `gem 'pghero'` и `gem 'pg_query'`.
Обозримых проблем инструмент не дал.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Обычно в этом ДЗ pghero прям показывает все индексы, которые стоит создать

Возможно не было достаточно данных у него для анализа / или что-то не заработало

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