You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The algorithm is maintaining its state by using few iterators that are allocated and reallocated too many times, the same state could be maintained by simple using integer counters. This could reduce memory consumption and make the algorithm a bit faster.
I wrote a simple synthetic benchmark to verify this, the benchmark uses chooseK to choose 10 items from a set of 28 (~13 millions combinations), and repeats for ten times. Here is the benchmark:
It showed that indeed we reduce the memory consumption, and get almost 15% performance increase, pictures below shows differential view between current algorithm and the refactored one using only integers of both memory and CPU measurements.
The text was updated successfully, but these errors were encountered:
The algorithm is maintaining its state by using few iterators that are allocated and reallocated too many times, the same state could be maintained by simple using integer counters. This could reduce memory consumption and make the algorithm a bit faster.
I wrote a simple synthetic benchmark to verify this, the benchmark uses
chooseK
to choose 10 items from a set of 28 (~13 millions combinations), and repeats for ten times. Here is the benchmark:It showed that indeed we reduce the memory consumption, and get almost 15% performance increase, pictures below shows differential view between current algorithm and the refactored one using only integers of both memory and CPU measurements.
The text was updated successfully, but these errors were encountered: