Skip to content

Commit

Permalink
graph: Reduce size of Atom to a u16
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lutter committed Apr 20, 2023
1 parent 805e05c commit 6fa363e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions graph/src/util/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use crate::runtime::gas::{Gas, GasSizeOf};

use super::cache_weight::CacheWeight;

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

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

0 comments on commit 6fa363e

Please sign in to comment.