Why is DateTime 36 bytes? #400
std::mem::size_of::<jiff::civil::DateTime>() = 36;
std::mem::size_of::<chrono::DateTime<chrono::FixedOffset>>() = 16;in comparison std::mem::size_of::<jiff::Timestamp>() = 40;
std::mem::size_of::<jiff::Zoned>() = 96;Timestamp is also quite big for what can be represented with u128, but Zoned is even bigger. Why is that? |
Answered by
BurntSushi
Aug 3, 2025
Replies: 2 comments 10 replies
|
Are you compiling jiff in debug mode or release mode? Please provide an MRE. |
0 replies
|
numbers posted above was debug mode. here it is in release mode on std::mem::size_of::<jiff::civil::DateTime>() = 12
std::mem::size_of::<jiff::Timestamp>() = 16
std::mem::size_of::<jiff::Zoned>() = 40this is interesting .. unless you did something specfic to padding / alignment based on build mode? normally they don't differ this much |
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is intentional. Debug mode uses ranged integers to track min and max runtime values to ensure correctness. This requires extra space that is only use in debug mode.