gccrs: Add dfs_cache for name resolution speedup
gccrs speeds up core compilation by caching DFS results during name resolution.
The gccrs compiler now includes a dfs_cache to optimize name resolution, which involves many depth-first searches. This caching mechanism significantly reduces compilation time for core components, shaving off nearly three minutes in testing. The implementation is a basic version, with potential for future improvements.
In Details
The gccrs compiler's name resolution, a critical phase, involves extensive Depth-First Searches (DFS). This commit introduces a simple cache for DFS results within the rust-forever-stack component to accelerate this process. It targets performance gains in compiling Rust's core libraries, where the overhead of repeated DFS traversals is substantial. Future work may involve optimizing this cache.
- dfs_cache
- A temporary cache used in
gccrsto store results of Depth-First Searches performed during name resolution. This avoids redundant computations and speeds up compilation. - name resolution
- The process in a compiler where identifiers (like variable or function names) are associated with their declarations. In
gccrs, this involves complex graph traversals like DFS. - rust-forever-stack
- A component within
gccrslikely responsible for managing scope and symbol information during name resolution and other compilation phases. - core compilation
- Refers to the process of compiling fundamental Rust libraries, such as the Rust standard library (
libcore). Optimizing this is crucial for overall development speed.