aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-30 00:05:55 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:57 -0700
commit61978c8c9473bc06fa1fde75e37374dd330ed614 (patch)
treec3e8a8a8ed707505df163de9fcdba018b5687bdf /src/codegen/c.zig
parent66f83f27a2904180bae7797a7c87c6eddc7eebff (diff)
downloadzig-61978c8c9473bc06fa1fde75e37374dd330ed614.tar.gz
zig-61978c8c9473bc06fa1fde75e37374dd330ed614.zip
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.
Diffstat (limited to 'src/codegen/c.zig')
0 files changed, 0 insertions, 0 deletions