use atomic variable instead of IntCounter to record request time.
if a request has fixed level, skip recording request time.
Atomic variable is faster to be allocated, which can save some time when request is very small. A simple spawn_many bench shows about 50% improvement.
If a request has fixed level, recorded request time will not have impact on itself, so it can be skipped completely. Although there may be requests share the same task ID, but mixing dynamic and fixed level usage seems odd to me. Bench shows that if spawn_many is benched with fixed level, multilevel is almost as fast as single_level.
This PR brings two updates:
IntCounter
to record request time.Atomic variable is faster to be allocated, which can save some time when request is very small. A simple spawn_many bench shows about 50% improvement.
If a request has fixed level, recorded request time will not have impact on itself, so it can be skipped completely. Although there may be requests share the same task ID, but mixing dynamic and fixed level usage seems odd to me. Bench shows that if
spawn_many
is benched with fixed level, multilevel is almost as fast as single_level.