From 6fa363e2bfb56c23840cdbe40cf331ea5c0b7bd4 Mon Sep 17 00:00:00 2001 From: David Lutterkort Date: Thu, 20 Apr 2023 11:01:05 -0700 Subject: [PATCH] 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. --- graph/src/util/intern.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graph/src/util/intern.rs b/graph/src/util/intern.rs index 1c039a73fa0..f7d0ee4b728 100644 --- a/graph/src/util/intern.rs +++ b/graph/src/util/intern.rs @@ -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.