# Notes on performance measures during development

#### Commit e34ea267 - 05.12.2019 - First Version of new Algorithm - Scaling Problems

The first version of our memory trading work stealing algorithm works. It still shows scaling issues over
the hyperthreading mark, very similar to what we have seen in version 1. This indicates some sort of
contention between the threads when running the FFT algorithm.

Analyzing the current version we find issue with the frequent call to `thread_state_for(id)` in
the stealing loop.

![](./media/e34ea267_thread_state_for.png)

It is obvious that the method takes some amount of runtime, as FFT has a structure that tends to only
work on the continuations in the end of the computation (the critical path of FFT can only be executed
after most parallel tasks are done).

![](./media/e34ea267_fft_execution_pattern.png)

What we can see here is the long tail of continuations running at the end of the computation. During
this time the non working threads constantly steal, thus requiring the `thread_state_for(id)`
virtual method, potentially hindering other threads from doing their work properly. 
