Avatar for the web-infra-dev user
web-infra-dev
rspack
BlogDocsChangelog

Replace std::collections::HashMap with rustc_hash::FxHashMap

#10676
Comparing
feature/replace-std-hashmap-with-rustc-hash
(
b58eb6d
) with
yj/enforce-fxhasher
(
a4648ff
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
12
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

rust@bundle-basic_sourcemap
tasks/benchmark/benches/groups/basic_build.rs::basic::basic_benchmark::rust@bundle-basic_sourcemap
CodSpeed Performance Gauge
+1%
4.2 ms
4.2 ms
rust@bundle-basic
tasks/benchmark/benches/groups/basic_build.rs::basic::basic_benchmark::rust@bundle-basic
CodSpeed Performance Gauge
+1%
4 ms
4 ms
js@Traverse module graph by dependencies
tests/bench/ts-react.bench.ts::TypeScript React project::js@Traverse module graph by dependencies
CodSpeed Performance Gauge
0%
546.1 µs
543.6 µs
rust@build_chunk_graph_parallel
tasks/benchmark/benches/groups/build_chunk_graph.rs::chunk_graph::build_chunk_graph_benchmark::rust@build_chunk_graph_parallel
CodSpeed Performance Gauge
0%
75 ms
74.7 ms
js@stats.toJson()
tests/bench/ts-react.bench.ts::TypeScript React project::js@stats.toJson()
CodSpeed Performance Gauge
0%
25.4 ms
25.4 ms
js@record module
tests/bench/ts-react.bench.ts::TypeScript React project::js@record module
CodSpeed Performance Gauge
0%
2 ms
2 ms
js@is css mod
tests/bench/ts-react.bench.ts::TypeScript React project::js@is css mod
CodSpeed Performance Gauge
0%
90.6 µs
90.7 µs
js@Traverse compilation.modules
tests/bench/ts-react.bench.ts::TypeScript React project::js@Traverse compilation.modules
CodSpeed Performance Gauge
0%
66.8 µs
66.9 µs
js@Traverse module graph by connections
tests/bench/ts-react.bench.ts::TypeScript React project::js@Traverse module graph by connections
CodSpeed Performance Gauge
0%
289.6 µs
290 µs
rust@build_chunk_graph
tasks/benchmark/benches/groups/build_chunk_graph.rs::chunk_graph::build_chunk_graph_benchmark::rust@build_chunk_graph
CodSpeed Performance Gauge
0%
96.8 ms
97 ms
js@collect imported identifiers
tests/bench/ts-react.bench.ts::TypeScript React project::js@collect imported identifiers
CodSpeed Performance Gauge
0%
221.3 µs
221.9 µs
js@record chunk group
tests/bench/ts-react.bench.ts::TypeScript React project::js@record chunk group
CodSpeed Performance Gauge
0%
91 µs
91.4 µs

Commits

Click on a commit to change the comparison range
Base
yj/enforce-fxhasher
a4648ff
0%
Replace std::collections::HashMap with rustc_hash::FxHashMap This commit replaces all usages of std::collections::HashMap with rustc_hash::FxHashMap throughout the rspack codebase for better performance. FxHashMap provides significantly better performance for string keys and is already widely used in the Rust ecosystem for performance-critical applications like rustc itself. Changes: - Replace import statements: std::collections::HashMap -> rustc_hash::FxHashMap as HashMap - Update type annotations to use FxHashMap - Add rustc-hash dependency to crates that needed it - Handle special cases where external APIs (like LightningCSS) still require std HashMap - Update HashMap construction from ::new() to ::default() where needed All tests pass and compilation succeeds with these changes.
b58eb6d
8 days ago
by hardfist
© 2025 CodSpeed Technology
Home Terms Privacy Docs