this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Short-circuit identifier comparison with hash before string compare

Identifier.compare was using Stdlib.compare on ikey strings, which
dispatches through the generic compare_val C function. Replace with
hash comparison first (Int.compare on precomputed ihash), falling
back to String.compare only when hashes collide.

This eliminates most string comparisons in Map lookups since
identifiers with different hashes are immediately distinguished.
Callgrind showed compare_val at 12% self-time on indexed_container_intf.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+6 -1
+6 -1
src/model/paths.ml
··· 180 180 181 181 let hash x = x.ihash 182 182 183 - let compare x y = compare x.ikey y.ikey 183 + let compare x y = 184 + (* Compare hash first to short-circuit in the common case where keys 185 + differ — avoids string comparison entirely for most Map lookups. *) 186 + let h = Int.compare x.ihash y.ihash in 187 + if h <> 0 then h 188 + else String.compare x.ikey y.ikey 184 189 185 190 type any = t 186 191