intern identifiers
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# Identifier interning benchmark
|
||||
|
||||
Run from the repository root:
|
||||
|
||||
```sh
|
||||
odin run benchmarks/symbols -o:speed
|
||||
```
|
||||
|
||||
The benchmark warms the pipeline once, then measures a fresh lex/parse/check
|
||||
run over a generated program with 5,000 repeated identifier-heavy statements.
|
||||
Timing is informational; token layout and allocation metrics are the stable
|
||||
comparison points.
|
||||
|
||||
Results captured on 2026-06-10 with Odin `dev-2026-02:b942f72cb`:
|
||||
|
||||
| Metric | Before interning | After interning |
|
||||
| --- | ---: | ---: |
|
||||
| Elapsed time | 15.723 ms | 9.248 ms |
|
||||
| Peak memory | 14,661,846 bytes | 13,220,507 bytes |
|
||||
| Allocations | 40,105 | 40,112 |
|
||||
| Token count | 65,032 | 65,032 |
|
||||
| Token size | 56 bytes | 48 bytes |
|
||||
| Unique symbols | n/a | 5 |
|
||||
| Stored symbol bytes | n/a | 21 |
|
||||
| Diagnostics | 0 | 0 |
|
||||
|
||||
The measured run reduced token size by 14.3% and peak tracked memory by 9.8%.
|
||||
Reference in New Issue
Block a user