TTF fonts map code-points (Code IDs) to glyphs. These are mappings from int to int. Because the JDK lacks map classes for primitive types, the code (e.g. in CmapSubtable) currently uses Map<Integer,Integer> for those mappings. This is inefficient in different ways:
- Autoboxing/unboxing introduces a performance penalty
- Boxing to Integer objects has a memory overhead
- The JDK Map implementation has a big memory overhead for such simple objects
For efficiency (execution time and memory consumption) I would propose to introduce a simple IntIntMap implementation which works with primitive integers.