Skip to content

Commit 8a620be

Browse files
committed
graph: Reduce size of Atom to a u16
With the current implementation, it doesn't save much memory compared to u32, but it makes sure we can fit all atoms into a u16, and enables a few more memory optimizations.
1 parent 58811ae commit 8a620be

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graph/src/util/intern.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use crate::runtime::gas::{Gas, GasSizeOf};
1818

1919
use super::cache_weight::CacheWeight;
2020

21-
// We could probably get away with a `u16` here, but unless we improve the
22-
// layout of `Object`, there's little point in that
23-
type AtomInt = u32;
21+
// An `Atom` is really just an integer value of this type. The size of the
22+
// type determines how many atoms a pool (and all its parents) can hold.
23+
type AtomInt = u16;
2424

2525
/// An atom in a pool. To look up the underlying string, surrounding code
2626
/// needs to know the pool for it.

0 commit comments

Comments
 (0)