3
24
Fork
You've already forked krabby
0
An experiment building a high-performance Rust compiler.
  • Rust 99.4%
  • Shell 0.6%
2026年05月11日 21:09:43 +02:00
src
test-data
.gitignore
Cargo.lock
Cargo.toml
CONTRIBUTING.md
LICENSE-APACHE
LICENSE-MIT
README.md
REUSE.toml
rust-toolchain.toml
rustfmt.toml

Krabby: An experiment building a high-performance Rust compiler

krabby is an experimental work-in-progress Rust compiler. It is a playground for experimenting with high-performance compiler architecture. Its goal is to serve as a roadmap for future compiler developers, so they can understand how to design a fast compiler for languages as complex as Rust; and perhaps to test out performance improvements for the standard Rust compiler.

Some ideas Krabby will explore:

  • Unifying Cargo and rustc into one multi-threaded process.
  • Taking a query-based approach to Cargo dependency resolution (e.g. fetching crates from the network in parallel with compilation).
  • Compiling across multiple crates concurrently, regardless of dependencies. (e.g. items in a crate foo are allowed to undergo name resolution before items in its dependency bar have)
  • Employing efficient data structures (e.g. with the (array-of-)struct-of-arrays paradigm), particularly for IRs.
  • Applying JIT-like dynamic optimizations for unexpectedly slow operations, e.g. particular macro expansions.
  • Unifying type inference and borrow-checking into a single step (rustc today redoes some work when borrow-checking because it separates these steps).
  • Optimizing for successful compilation: reducing the number of checks (e.g. "is this identifier valid UTF-8?") that block later compilation work and allowing them to be performed later, to increase parallelism.

Krabby is not intended to be a production-ready compiler (e.g. rustc), but rather to explore interesting ideas that get discounted because they would be hard to implement in a production-ready compiler. It seeks to test these ideas and mature them so they can be taken seriously by production-ready compilers. And above all else, it seeks to be fast!

Status

krabby is under active development, and is far from being useful. Its primary entry point is krabby check, which is meant to emulate cargo check. At the moment, krabby check will:

  • Read Cargo.toml
  • Read Cargo.lock
  • Load the current workspace, if any
  • Identify library crates in Cargo packages
  • Parse source code (with syn, temporarily)
  • Resolve crate dependencies and feature flags
  • Perform local name resolution
  • Perform global name resolution

If you are interested in contributing: first of all, thank you! Please take a look at CONTRIBUTING.md.

License

Copyright (c) arya dradjica and the krabby contributors

This software is available under the MIT license or Apache-2.0 license, at your option. See LICENSE-MIT or online, and LICENSE-APACHE or online for more information.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.