Skip to content

task-1(cpu): use benchmarks and profilers for finding speed points #143

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

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.

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


Добавил новый 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.

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

- какой отчёт показал главную точку роста
- как вы решили её оптимизировать
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