Benchmarking and optimizing the Carbon compiler
summary
Project aims for an absurdly fast compiler and finds the real bottleneck in the lexer: identifier interning into a hash table. Uses Google Benchmark, Basil build runs, and a source-generator plus script (script/bin/benchrunner.py) to create realistic, histogram-driven files. Replaces/rewrites hash internals (Carbon hash vs Abseil) and adds table-dispatch/musttail lexer code; results show Carbon hash vs Abseil lookup hits ~23% faster and insertion sequences up to 2x faster, hitting roughly 10M lines/sec lexing on an M4 and ~1M lines/sec for checks.
AI-written summary · about
chapters (13)
- 0:00Compiler benchmarking intro
- 1:14Lexer bottleneck revealed
- 3:41Hash tables in compilers
- 8:37Reusable hash benchmarks
- 14:20Hash table insertion perf
- 20:19Noisy results analysis
- 28:12Optimizing hash tables
- 32:27Compiler benchmark infra
- 38:43Generating test code
- 51:01Compiler throughput metrics
- 55:44Hardware counters insights
- 57:32Lexer table-based dispatch
- 1:01:19Key takeaways
related talks
21mGetting the Most Bang out of your Buck with Compilers on POWER
31mThe AST Galaxy to the Virtual Machine Blues
01h 23mCarbon Language: An experimental successor to C++
24m(Ab)using Compiler Tools
21mDiagnosing Compiler Performance by Comparing Optimization Decisions
56mKeynote: Benchee: 9 Years of Benchmarking on the BEAM
44mKeynote
22mBeacons: An End-to-End Compiler Framework for Predicting and Utilizing Dynamic ...
