-
Notifications
You must be signed in to change notification settings - Fork 53
Only use 48 bits for encoding timestamps and 32 bits for encoding thread IDs in RawEvent in order to make it smaller. #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only use 48 bits for encoding timestamps and 32 bits for encoding thread IDs in RawEvent in order to make it smaller. #86
Conversation
|
Note to myself for tomorrow: Make event encoding endianess independent as part of this PR. |
…ead IDs in RawEvent in order to make it smaller.
4a0a5ff to
01766c5
Compare
|
I added two commits:
The second commit makes the |
01766c5 to
c8c1e95
Compare
|
I went ahead and moved the last commit to a separate, less urgent PR (#88). This PR is ready for review. |
wesleywiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
| LittleEndian::write_u32(&mut bytes[12..], self.start_time_lower); | ||
| LittleEndian::write_u32(&mut bytes[16..], self.end_time_lower); | ||
| LittleEndian::write_u32(&mut bytes[20..], self.start_and_end_upper); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, was the "manual" version benchmarked on x64?
The only reason I can think of is that it might be slower to write six u32s, one at a time (as opposed to 3 u64 or one u128 and one u64), but that's possible to alleviate, but first serializing to larger integers and then writing them out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the two versions were almost the same with the manual one having one instruction more (and the whole fn being something 10 instructions). I don't expect there to be much difference in practice since there is more expensive stuff going (like writing this data to disk).
This restricts us to timestamps of at most ~78 hours after process start which seems acceptable.
The PR reduces the size of
RawEvent(and thus the size of our event stream files) by 25%.