Replace O(n^2) shadow detection with O(n) hash counting
value_name_exists, type_name_exists, etc. did a linear List.exists
scan of remaining items for each item processed — O(n^2) total.
Callgrind showed this as 16% of CPU on Container_intf (150K items).
Replace with a single pre-pass that counts names per kind in a
Hashtbl, then O(1) check-and-decrement during processing.
Result: read_impl drops from 3.77s to 2.87s (-24%) on Container_intf.
The function disappears entirely from the callgrind profile.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>