# Use a slice for InstMap instead of std.HashMap · gitcafe/zig

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

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

Visibility: public

Requested revision: 609716524169c538b7f12666c3f9bb46a0aeeb3c

Requested commit: 609716524169c538b7f12666c3f9bb46a0aeeb3c

Commit: 609716524169c538b7f12666c3f9bb46a0aeeb3c

Tree: 3c7634b5391a1bc8568b07717e988b888334f79e

Author: Jimmi Holst Christensen

Committer: Andrew Kelley

## Message

```
Use a slice for InstMap instead of std.HashMap

The `sema.inst_map` datastructure is very often accessed. All
instructions that reference the result of other instructions does a
lookup into this field. Because of this, a significant amount of time,
is spent in `std.HashMap.get`.

This commit replaces the `HashMap` with a simpler data structure that
uses the zir indexes to index into a slice for the result. See the data
structure doc comment for more info.

```

## Parents

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

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