diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-30 00:05:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:47:57 -0700 |
| commit | 61978c8c9473bc06fa1fde75e37374dd330ed614 (patch) | |
| tree | c3e8a8a8ed707505df163de9fcdba018b5687bdf /src/codegen/c.zig | |
| parent | 66f83f27a2904180bae7797a7c87c6eddc7eebff (diff) | |
| download | zig-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
