# std.debug: significantly speed up capturing stack traces · gitcafe/zig

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

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

Visibility: public

Requested revision: 156cd8f678ebdcccc48382d093a3ef7e45c85a45

Requested commit: 156cd8f678ebdcccc48382d093a3ef7e45c85a45

Commit: 156cd8f678ebdcccc48382d093a3ef7e45c85a45

Tree: ca3f4c37bda9cf1d039ac25ba37b2c45ab5a345f

Author: mlugg

Committer: mlugg

## Message

```
std.debug: significantly speed up capturing stack traces

By my estimation, these changes speed up DWARF unwinding when using the
self-hosted x86_64 backend by around 7x. There are two very significant
enhancements: we no longer iterate frames which don't fit in the stack
trace buffer, and we cache register rules (in a fixed buffer) to avoid
re-parsing and evaluating CFI instructions in most cases. Alongside this
are a bunch of smaller enhancements, such as pre-caching the result of
evaluating the CIE's initial instructions, avoiding re-parsing of CIEs,
and big simplifications to the `Dwarf.Unwind.VirtualMachine` logic.

```

## Parents

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

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