# InternPool: optimize zigTypeTag\(\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c8b0d4d149c891ed83db57fe6986d10c5dd654af)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c8b0d4d149c891ed83db57fe6986d10c5dd654af

Requested commit: c8b0d4d149c891ed83db57fe6986d10c5dd654af

Commit: c8b0d4d149c891ed83db57fe6986d10c5dd654af

Tree: 80074b404e9d6b425e233e534f43ffa2c7d96ba9

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
InternPool: optimize zigTypeTag()

This is a particularly hot function, so we operate directly on encodings
rather than the more straightforward implementation of calling
`indexToKey`.

I measured this as 1.05 ± 0.04 times faster than the previous commit
with a ReleaseFast build against hello world (which includes std.debug
and formatted printing).

I also profiled the function and found that zigTypeTag() went from being
a major caller of `indexToKey` to being completely insignificant due to
being so fast.

```

## Parents

- [fc358435cb5cbcc21967af438b190d4e18bba9ae](https://git.cafe/gitcafe/zig/commit/fc358435cb5cbcc21967af438b190d4e18bba9ae?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c8b0d4d149c891ed83db57fe6986d10c5dd654af?format=markdown)
