perf(breadcrumbs): use unix epoch for timestamps #1525
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.
Goal
Improve performance on the breadcrumb storage "hot path" by removing Date formatting. Adds support for millisecond time resolution as a bonus.
Design
Created an encoding for timestamps where the date value is sent using the pattern
t[0-9]+
, where the number is the count of milliseconds since the epoch and thet
indicates that timestamp parsing should be used. The breadcrumb added state event serializes the timestamp into this format, which is what is now persisted to disk in the event of a crash.Changeset
Questions
What would be the best way to express optimization changes as a part of a PR? We haven't done a lot of perf-specific improvements and we probably need some standardization here. For example, I can diff the bugsnag-benchmarks entry for simple and complex breadcrumbs and include that in the description?
A flame graph of the breadcrumb path is basically the same as before, just chopping all of the date parsing logic from the top. 🪓
Testing