Skip to content

Conversation

@shilovk
Copy link

@shilovk shilovk commented May 1, 2024

No description provided.

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.

.DS_Store

# Ignore specific file extensions in all directories.
*.txt
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 @@
3.3.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

gem 'ruby-prof'
gem 'ruby-prof-speedscope'
gem 'stackprof'
gem 'vernier'
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍👍


### Ваша находка №1
## Вникаем в детали системы, чтобы найти главные точки роста
Для того, чтобы найти "точки роста" для оптимизации я воспользовался всеми профайлерами из лекции, чтобы получить опыт.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

### находка №1

1) Написал тест задав бюджет: 30 секунд и линейной асимптотикой.
2) При выполнении на маленьком data.txt получил логарифмическую асимптотику.
Copy link
Collaborator

Choose a reason for hiding this comment

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

логарифмическая это лучше линейной (либо опечатка, либо тест некорректный результат показал)

Добавил rubyprof flamegraph не затронутый в лекции и установил speedscope локально, чтобы командой запускать:
`speedscope ruby_prof_reports/task-1_flamegraph_data_file_data20000.txt_disable_gc_true.json`

Добавил новый Firefox Profiler, используя гемы:
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 понравилось?

### находка №2
- какой отчёт показал главную точку роста
- как вы решили её оптимизировать
rubyprof - flat
Copy link
Collaborator

Choose a reason for hiding this comment

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

в чём была проблема - не понятно, как поправили, тоже не понятно

uniqueBrowsers += [browser] if uniqueBrowsers.all? { |b| b != browser }

# uniqueBrowsers += [browser] if uniqueBrowsers.all? { |b| b != browser }
unique_browsers << browser unless unique_browsers.include?(browser)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Set

RubyProf.measure_mode = RubyProf::WALL_TIME

result = RubyProf::Profile.profile do
work(ENV.fetch('DATA_FILE', nil), disable_gc: ENV.fetch('DISABLE_GC', true))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Внутри метода вроде была тоже какая-то логика про ENV-переменную

По дефолту disable_gc: true лучше не стоит, это временная мера на случай если GC вносит сумятицу в профилирование

DISABLE_GC=$disable_gc DATA_FILE=$filename ruby task-1_vernier.rb

# Запуск тестов
ruby task-1_test.rb
Copy link
Collaborator

Choose a reason for hiding this comment

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

лайк за скрипт; делать себе удобно - окупается

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