[Task 3] Database usage optimization#3
Closed
robot-den wants to merge 3 commits intohardcode-dev:masterfrom
Closed
[Task 3] Database usage optimization#3robot-den wants to merge 3 commits intohardcode-dev:masterfrom
robot-den wants to merge 3 commits intohardcode-dev:masterfrom
Conversation
spajic
approved these changes
Sep 6, 2019
Collaborator
spajic
left a comment
There was a problem hiding this comment.
Отличная работа, чистый код, всё хорошо 👍
| @@ -0,0 +1,5 @@ | |||
| # frozen_string_literal: true | |||
|
|
|||
| # Model for convenient access to join table | |||
|
|
||
| Ruby-prof по времени не показал точек роста - отчет в основном состоит из внутренностей Rails. | ||
|
|
||
| Собрал лог из базы данных и скормил его pgbadger - оказалось что для вставки 1_000 записей выполняется 13_528 запросов к базе. |
| Чтобы понять, несут ли изменения положительный эффект, в качестве метрики выбрано время загрузки страницы для файла large.json. | ||
|
|
||
| #### Гарантия корректности работы программы | ||
| Для гарантии корректной работы написан тест проверяющий что контроллер выдает корректный html для файла `example.json` |
| Для защиты от регрессии добавил тест, который проверяет время ответа контроллера. К сожалению время ответа очень сильно различается от теста к тесту, поэтому с запасом указал 0.5 сек для файла example.json | ||
|
|
||
| #### P.S. | ||
| Понимаю, что нет предела совершенству - можно и "справочники" превратить в константы, и кеширование добавить во вьюхи и пагинацию на страницы, но устал :) |
| # frozen_string_literal: true | ||
|
|
||
| # Populates database with records from json file | ||
| class PopulateDatabase |
otmosina
added a commit
to otmosina/rails-optimization-task3
that referenced
this pull request
May 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.