Why is Plan9's compiler so fast?
- User
Why is Plan9's compiler so fast?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Why is Plan9's compiler so fast?
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Plan 9's compilers (like 8c for x86, 5c for ARM, etc.) are famously fast due to a combination of deliberate simplicity, minimalist design choices, and unique features of the Plan 9 ecosystem. Here are the key reasons:
#include directives internally by reading files directly.mk) uses file modification timestamps and avoids complex dependency graphs (like make). This eliminates parsing Makefiles and traversing headers recursively.8c for x86) is a single binary handling lexing, parsing, and codegen—no separate preprocessor/assembler/linker invocations.8l) is extremely fast due to its simple a.out-like executable format and lack of dynamic linking (most code is statically linked)./dev/bit for debug info), avoiding filesystem bottlenecks.#pragma is banned) and encourages simple code."When in doubt, use brute force."
This meant avoiding theoretical elegance in favor of straightforward, efficient code.
| Feature | Plan 9 Compiler | Modern Compiler (GCC/Clang) |
|---|---|---|
| Optimizations | Almost none | Multiple high-level passes (O1-O3, LTO) |
| Intermediate Stages | None (single-pass) | AST, IR (LLVM), multiple passes |
| Dependency Handling | Timestamps + #include | Preprocessor + complex build systems |
| Linker | Fast, static-only | Slower, supports dynamic linking |
| Target Flexibility | One compiler per architecture | Single compiler with many backends |
While Plan 9’s compilers are impractical for modern optimized code, their design inspires tools like:
make (e.g., Go’s go build).In essence, Plan 9’s speed comes from embracing constraints: sacrificing optimization and complex features for raw compilation velocity. It’s a testament to how simplicity can achieve remarkable performance in specialized contexts.