# stage2: VarDecl and FnProto take advantage of TrailerFlags API · gitcafe/zig

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

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

Visibility: public

Requested revision: 804b51b179bf7af689d308a092d1b02e94674570

Requested commit: 804b51b179bf7af689d308a092d1b02e94674570

Commit: 804b51b179bf7af689d308a092d1b02e94674570

Tree: ebc4cb661d0bbe4556de0a1659fc0dab99a8114d

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: VarDecl and FnProto take advantage of TrailerFlags API

These AST nodes now have a flags field and then a bunch of optional
trailing objects. The end result is lower memory usage and consequently
better performance. This is part of an ongoing effort to reduce the
amount of memory parsed ASTs take up.

Running `zig fmt` on the std lib:
 * cache-misses: 2,554,321 => 2,534,745
 * instructions: 3,293,220,119 => 3,302,479,874
 * peak memory: 74.0 MiB => 73.0 MiB

Holding the entire std lib AST in memory at the same time:

  93.9 MiB => 88.5 MiB

```

## Parents

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

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