diff --git a/Cargo.lock b/Cargo.lock
index 65ce7d4..c5af765 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -19,6 +19,7 @@ dependencies = [
"nom",
"peg_macro",
"pest",
+ "rustc-hash",
]
[[package]]
@@ -231,6 +232,12 @@ dependencies = [
"proc-macro2",
]
+[[package]]
+name = "rustc-hash"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+
[[package]]
name = "rustversion"
version = "1.0.21"
diff --git a/Cargo.toml b/Cargo.toml
index b4d78b6..4e0a4bc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ insta = "1.39.0"
nom = "7.1.3"
pest = "2.7.15"
compact_str = "0.9.0"
+rustc-hash = "2.1.1"
[dev-dependencies]
insta = "1.39.0"
diff --git a/src/labels/process.rs b/src/labels/process.rs
index dc4bdd0..fe870a2 100644
--- a/src/labels/process.rs
+++ b/src/labels/process.rs
@@ -1,4 +1,5 @@
use compact_str::CompactString;
+use rustc_hash::FxHashMap;
use crate::world::Board;
@@ -43,8 +44,17 @@ pub fn process_labels(board: &mut Board) {
/// Resolve ".local" labels to "name.local" form.
fn resolve_local_labels(stats: &mut [ParsedStat]) {
for stat in stats.iter_mut() {
- let mut section_counter = 0;
- let mut section = CompactString::const_new("$0");
+ // Helper: Generate unique section strings like "touch$0"
+ let mut i = 0;
+ let mut make_section_id = |label_name: &str| -> CompactString {
+ let result = format!("{}${}", &label_name, i);
+ i += 1;
+ result.into()
+ };
+
+ let mut namespace_to_section: FxHashMap