feat(SnowflakeUtil): add timestampFrom
#7058
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the changes this PR makes and why it should be merged:
Also refactors anything using
SnowflakeUtil.deconstruct(id).timestamp
to use this new utility. This continues the work in #7036.SnowflakeUtil.timestampFrom
is a performance-focused utility designed to skip a lot of the decoder's overhead, as shown in the chart below:deconstruct(id).timestamp
timestampFrom
10000
100000
1000000
In retrospective, the
deconstruct
method in main is almost twice as fast as the one in 13.3.1, so we'll see a large performance boost in manycreatedTimestamp
getters across the library in the next version 馃憖Also, something odd I noticed is that we don't read
data.timestamp
inMessage
, as the value it yields is identical to getting thetimestamp
field from the ID, perhaps we can remove the field and reduce memory usage for messages, as well as lazy calculate the value? Perhaps it was stored due to performance concerns since sweepers rely oncreatedTimestamp
, but with this performance boost, it should be reasonably fast for the performance trade-off (?)Status and versioning classification: