Value
s should box BaseFn
s
#61
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: twc/ludus#61
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently,
Value::BaseFn
takes ownership of theBaseFn
inside, and those are 32 bytes wide. That means thatValue
s are 32 bytes wide, too.We can get
Value
down to 8 bytes by puttingBaseFn
s in aBox
. Do that. It's an easy win.Done. This, however, only reduces us to 24 bytes. Keywords and interned strings are, under the hood,
&'static str
s, which are 16 bytes wide. That meansValue
has three 8-byte aligned fields: the tag, a pointer, and then a size (usize
) for the&'static str
s.The only way to get smaller would be to
Box
the&'static str
s, which means two dereferences, and that gets us from 24 to 16. The only way to get smaller is to use NaN boxing or tagged pointers, both of which require unsafe rust. So that's NOT for now.