task-1(cpu): use benchmarks and profilers for finding speed points#143
Open
shilovk wants to merge 9 commits intohardcode-dev:masterfrom
Open
task-1(cpu): use benchmarks and profilers for finding speed points#143shilovk wants to merge 9 commits intohardcode-dev:masterfrom
shilovk wants to merge 9 commits intohardcode-dev:masterfrom
Conversation
# Conflicts: # .gitignore # Gemfile # case-study-template.md # update_reports.sh
# Conflicts: # .gitignore # Gemfile # case-study-template.md # update_reports.sh
# Conflicts: # update_reports.sh
# Conflicts: # update_reports.sh
# Conflicts: # update_reports.sh
spajic
approved these changes
May 6, 2024
| .DS_Store | ||
|
|
||
| # Ignore specific file extensions in all directories. | ||
| *.txt |
| @@ -0,0 +1 @@ | |||
| 3.3.0 | |||
| gem 'ruby-prof' | ||
| gem 'ruby-prof-speedscope' | ||
| gem 'stackprof' | ||
| gem 'vernier' |
|
|
||
| ### Ваша находка №1 | ||
| ## Вникаем в детали системы, чтобы найти главные точки роста | ||
| Для того, чтобы найти "точки роста" для оптимизации я воспользовался всеми профайлерами из лекции, чтобы получить опыт. |
| ### находка №1 | ||
|
|
||
| 1) Написал тест задав бюджет: 30 секунд и линейной асимптотикой. | ||
| 2) При выполнении на маленьком data.txt получил логарифмическую асимптотику. |
Collaborator
There was a problem hiding this comment.
логарифмическая это лучше линейной (либо опечатка, либо тест некорректный результат показал)
| Добавил rubyprof flamegraph не затронутый в лекции и установил speedscope локально, чтобы командой запускать: | ||
| `speedscope ruby_prof_reports/task-1_flamegraph_data_file_data20000.txt_disable_gc_true.json` | ||
|
|
||
| Добавил новый Firefox Profiler, используя гемы: |
| ### находка №2 | ||
| - какой отчёт показал главную точку роста | ||
| - как вы решили её оптимизировать | ||
| rubyprof - flat |
Collaborator
There was a problem hiding this comment.
в чём была проблема - не понятно, как поправили, тоже не понятно
| uniqueBrowsers += [browser] if uniqueBrowsers.all? { |b| b != browser } | ||
|
|
||
| # uniqueBrowsers += [browser] if uniqueBrowsers.all? { |b| b != browser } | ||
| unique_browsers << browser unless unique_browsers.include?(browser) |
| RubyProf.measure_mode = RubyProf::WALL_TIME | ||
|
|
||
| result = RubyProf::Profile.profile do | ||
| work(ENV.fetch('DATA_FILE', nil), disable_gc: ENV.fetch('DISABLE_GC', true)) |
Collaborator
There was a problem hiding this comment.
Внутри метода вроде была тоже какая-то логика про ENV-переменную
По дефолту disable_gc: true лучше не стоит, это временная мера на случай если GC вносит сумятицу в профилирование
| DISABLE_GC=$disable_gc DATA_FILE=$filename ruby task-1_vernier.rb | ||
|
|
||
| # Запуск тестов | ||
| ruby task-1_test.rb |
Collaborator
There was a problem hiding this comment.
лайк за скрипт; делать себе удобно - окупается
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.