Explore migrating Recency
to use timestamps directly.
#279
Labels
C-util
Component: utility classes and helpers.
E-complex
Effort: complex.
T-enhancement
Type: enhancement.
T-experiment
Type: experiment.
It struck me that it may be possible to utilize timestamps directly in the metric primitives for
Recency
instead of needing to track a generation counter and then also store the last seen times for metrics.Pros:
u64
Cons:
Using
quanta
could be an answer to the "measuring current time might be slow" bit, doubly so using the "recent time" feature... but it could conflict with applications that used that feature for their own purposes. If their updates were too coarse, or got stopped for some reason, recency tracking could break.While querying the current time might take 10-15ns in the very best case, incrementing an atomic counter can be close to half of that. Additionally, we would still need to atomically store the time which means we would be both querying the time and atomically storing it. The concept itself is not entirely unworkable given that it has tangible improvements to the clarity of the code, but we might need a more sophisticated approach to reduce the overhead.
The text was updated successfully, but these errors were encountered: