Skip to content

Optimization#17

Open
StanisLove wants to merge 12 commits intospajic:masterfrom
StanisLove:optimization
Open

Optimization#17
StanisLove wants to merge 12 commits intospajic:masterfrom
StanisLove:optimization

Conversation

@StanisLove
Copy link

No description provided.

Copy link
Owner

@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.

Очень хорошая работа!
Особый респект за MiniTest::Benchmark и ассерт линейной асимптотики.

Плюс несколько комментов по ходу.

require 'minitest/autorun'
require './task-1'

class BenchTest < MiniTest::Benchmark
Copy link
Owner

Choose a reason for hiding this comment

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

👍 👍

end

def bench_algorithm
assert_performance_linear 0.9999 do |n|
Copy link
Owner

Choose a reason for hiding this comment

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

👍

end
end

def algorithm(lines_num)
Copy link
Owner

Choose a reason for hiding this comment

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

👍

Аллоцируется 400 Mb объектов класса Array и 16 Mb класса String.
Более всего памяти для класса Array выделяется в строках 53, 54, 100, 102.
Более всего памяти для класса String выделяется в строках 39,46, 52, 139, 142.
Аллоцируются одинаковые строки `" ", "session", ",", "user"`
Copy link
Owner

Choose a reason for hiding this comment

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

Case-study лучше читается, когда в этом же блоке сразу и результат.


## Результаты
В результате проделанной оптимизации наконец удалось обработать файл с данными.
Удалось улучшить метрику системы
Copy link
Owner

Choose a reason for hiding this comment

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

Хорошо бы указать с какого до какого значения.


## Защита от регресса производительности
Для защиты от потери достигнутого прогресса при дальнейших изменениях программы
написан тест `bench_test.rb`.
Copy link
Owner

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