Closed dcendents closed 1 year ago
Patch coverage: 100.00
% and project coverage change: +0.05
:tada:
Comparison is base (
73c2393
) 95.40% compared to head (c52a5fa
) 95.45%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
thanks for the review, I have modified the code to use cached_property
.
However there is no setter on a cached_property
so I still had to create a new property to keep name
as is.
Performance is the same
Let me know what you think
Hi @youtux ,
Actually you were right we can del self.full_name
but we do need to validate the key is in __dict__
first, which I was not doing the first time around and caused the error I mentionned.
Anyway that showed my modifications were lacking proper testing so I added a unit test as well to validate the cache behavior.
I really tried to use a mock to wrap the step object and spy on the full_name
method (property) but I could not make it work, so I hope you are ok with the way I tested it.
Changing values directly on the step object to show the cache value is still returned (which should never happen in production code). Changing values using properties show the cache is invalidated.
Cheers
Hi,
Using py-spy to check where to improve the performance of my tests, I noticed a lot of time was spent in the Step name property. Just by caching the value instead of recalculating it every time I gain ~15%. Same gain when I run the tests in parallel
Sequence:
Parallel:
It is a very minor change, hope it can be merged.
Thanks