Does JLanguageTool class loads dictionary/grammar rules or any other config from file every time when objects are created?
Like
JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
Or it reads once when class is initialized for first time? I am interested in the performance impact of initializing new object due to file operation or any other heavy lifting?
For best performance, the recommended approach is to create a new JLanguageTool, but to create the language only once (e.g. new English()) and use that for all JLanguageTool instances. In other words, creating the language takes performance, not the JLanguageTool object.
We have only recently introduced better thread-safety though so for a production system you might still want to create a new language as there might still be bugs lurking in the approach described above.
I have created the new English() language only once, When i tried with multiple request, it results in a Run Time Error(BufferUnderflowException) and all my other requests gets failed. Any work around for this?
BTW just to check performance, i have increased my Heap memory space to 10G and tried,