peepmatic: Represent various id types with u16

These ids end up in the automaton, so making them smaller should give us better
data cache locality and also smaller serialized sizes.
This commit is contained in:
Nick Fitzgerald
2020-05-07 13:56:02 -07:00
parent 469104c4d3
commit 210b036320
7 changed files with 27 additions and 27 deletions

View File

@@ -46,7 +46,7 @@ impl Path<'_> {
/// An identifier for an interned path.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct PathId(u32);
pub struct PathId(u16);
/// An interner and de-duplicator for `Path`s.
///
@@ -93,7 +93,7 @@ impl PathInterner {
#[inline(never)]
fn intern_new<'a>(&mut self, path: Path<'a>) -> PathId {
let id: u32 = self
let id: u16 = self
.paths
.len()
.try_into()