mirror of
https://codeberg.org/ziglang/zig
synced 2026-11-18 07:05:05 +00:00
InternPool: eliminate indexToKey call graph cycle
Recursion makes this hot function more difficult to profile and optimize. I measured a 1.05x speedup vs the previous commit with the (set of passing) behavior tests. This commit was the last in a series, and the main thing it needed to do was make InternPool.typeOf not call indexToKey(). This required adding a type field to the runtime_value encoding even though it is technically redundant. This could have been avoided with a loop inside typeOf, but I wanted to keep the machine code of that hot function as simple as possible. The variable encoding is still responsible for a relatively small slice of the InternPool data size. I added a function that provides the payload type corresponding to the InternPool.Tag type, which allows for some handy inline switch prongs. Let's start moving the structs that are specific to InternPool.Tag into the corresponding namespace. This will provide type safety if the encoding of InternPool changes for these types later.
This commit is contained in:
parent
66f83f27a2
commit
61978c8c94
1 changed files with 243 additions and 57 deletions
Loading…
Add table
Add a link
Reference in a new issue