Hello all,

I often run multiple models in production, often trained on the same data
but with different types (typical name finder scenario). There could be one
model to detect person names, and another to detection locations. The
predicate Strings inside those models are always the same but the models
can't share the same String instance.

I would like to propose that we use String.intern in the model reader to
ensure one string is only loaded once.

We tried that in the past and this caused lots of issues with PermGen
space, but this was improved over time in Java. In Java 8 (on which we
depend now) this should work properly.

Here is an interesting article about it:
http://java-performance.info/string-intern-in-java-6-7-8/

Using String.intern will make the model loading a bit slower (we can
benchmark that).

Jörn

Reply via email to