Cache mode printing to avoid repeated Format.asprintf
OxCaml mode annotations (locality, uniqueness, linearity, etc.) were
printed via Format.asprintf per argument type, allocating a fresh
Format buffer each time. With 150K items × multiple args, this was
24% of allocation in statmemprof.
Cache the result per mode constant value (small finite set — ~16
entries). Reduces minor heap allocation by 20%.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>