Closed atamakahere-git closed 4 months ago
Hey @fee1-dead , I applied your suggested changes, and it seems like .min()
is loosing performance compared to .fold()
.
Can you run the benchmark and tell if that's the same case on other machines too?
I don't have much time to run benchmarks myself, but I can trust the results. fold
doesn't look that bad stylistically when compared to min
.
This has been merged to the main branch. Thank you for contributing!
I was tinkering with the code, to my surprise I made
Estimator
run faster just by using iterators instead of for-loopsThe overall diff is about 60% faster on single thread
Pingora Estimator single thread 2.334566806s total, 23ns avg per operation
vs
Pingora Estimator single thread 868.937015ms total, 8ns avg per operation
There is 2ns gain per thread, from 25ns -> 23ns (8%).
I have attached the complete bench diff for my machine: https://www.diffchecker.com/9EnuDEot/
I may be missing/ignoring something here, cause this is too good to be true.
Though this is a documented and tested behavior.
I have also added a test for
reset
method, which might be redundant.