# print_zir: speed up ZIR printing · gitcafe/zig

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

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

Visibility: public

Requested revision: 01906a3ad8b792627e55551686c25d02fef64e98

Requested commit: 01906a3ad8b792627e55551686c25d02fef64e98

Commit: 01906a3ad8b792627e55551686c25d02fef64e98

Tree: af2bb5724e33fd6c761f025aee60041482aa25ef

Author: mlugg

Committer: mlugg

## Message

```
print_zir: speed up ZIR printing

Source location resolution previously made ZIR printing incredibly slow,
since it was O(N^2). Since we usually resolve source locations
approximately in order, it is much more efficient to resolve them using
a "cursor" which navigates the file.

This takes the time for `zig ast-check -t Sema.zig` down from many
minutes (enough that I got bored and killed the process; well over 10)
to a few seconds.

```

## Parents

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

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