Skip to content

Task 2. CPU optimization#3

Open
paderinandrey wants to merge 11 commits intospajic:masterfrom
paderinandrey:task-2-cpu-optimization
Open

Task 2. CPU optimization#3
paderinandrey wants to merge 11 commits intospajic:masterfrom
paderinandrey:task-2-cpu-optimization

Conversation

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

Аппрув, спасибо за работу!

## Вникаем в детали системы, чтобы найти 20% точек роста
### RbSpy
По flamegraph видно, что больше всего процессорного времени занимает си функции и сбор статистики пользователя
![massif visualizer](img/flamegraph.png)
Copy link
Owner

Choose a reason for hiding this comment

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

Опечатка massif visualizer -> flamegraph

Вот какие проблемы удалось найти и решить

## 1. iso8601
Метод iso8601 по капотом которого находится регулярка забирает значительный процент ресурса процессора. Вынес его в отдельный метод и переписал
Copy link
Owner

Choose a reason for hiding this comment

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

👍

```
в результате ips существенно увеличилось до **6,75** время выполения программы составило **~5 сек**

В целом считаю преобразование в iso8601 лишней операцией, т.к. дата в исходных данных, уже в формате iso8601.
Copy link
Owner

Choose a reason for hiding this comment

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

Согласен, операция лишняя.

sort! { |x, y| x <=> y }
```
Получил незначительный прирост производительности **9,8 ips**
Также была попытка использовать `SortedSet` но это только ухудшило метрику, пришлось откатываться
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