ghostty-org/ghostty

Convert `cell.isSymbol` to use a LUT

Closed this issue · 1 comments

Follow-on to #8510

This lives in renderer/cell.zig when really it should be in font, but that's a refactor for another day. Right now we just need to do this TODO since it's in a hot path and is way too much work with all these checks in a row when it could be a LUT.

pub fn isSymbol(cp: u21) bool {
// TODO: This should probably become a codegen'd LUT
return ziglyph.general_category.isPrivateUse(cp) or
ziglyph.blocks.isDingbats(cp) or
ziglyph.blocks.isEmoticons(cp) or
ziglyph.blocks.isMiscellaneousSymbols(cp) or
ziglyph.blocks.isEnclosedAlphanumerics(cp) or
ziglyph.blocks.isEnclosedAlphanumericSupplement(cp) or
ziglyph.blocks.isMiscellaneousSymbolsAndPictographs(cp) or
ziglyph.blocks.isTransportAndMapSymbols(cp);
}

This should probably use the existing unicode LUT generation stuff we have, though it's for a boolean property so maybe worth trimming down, idk. Should validate this change with benchmarks to make sure the overhead of the LUT isn't worse than the multiple lookups here.

I'm going to throw this into the 1.2 milestone just to try and see if it makes sense.