Hacker News new | ask | show | jobs
by juancn 12 days ago
Interning can be really helpful.

In the early noughties I worked in a compiler in Java, and using String.intern() at the lexical level helped a lot with compiling speed and garbage generation.

It can be a neat trick, since you do it at lexing time and you speed up any subsequent String.equals() call.

It was particularly important for us because we called it very often in an IDE in the editor for error highlighting and auto completion and you want sub-300ms responses or it feels extremely slow.

Machines at the time were under 1GB of RAM and fairly slow