Solving performance problems

You are here: Home > Support > Sentry Spelling Checker Engine > Java SDK

Product: Sentry Spelling Checker Engine Java SDK, Any version

Problem: When checking spelling or looking up suggestions, Sentry seems to take longer than expected.

Solutions:

The Java Virtual Machine (JVM) used can have a dramatic bearing on the performance of the spelling engine. Newer JVM versions have highly optimized garbage collectors that significantly reduce memory management overhead in the spelling engine. Tuning the JVM's memory allocation through parameters may also help.

Disabling the case-sensitive option will reduce performance. Sentry's dictionaries are optimized for case-sensitive access. When case-sensitivity is disabled, Sentry sometimes has to search for a word several times (e.g., search for the capitalized form, uncapitalized form, etc.). This can result in reduced performance. Other causes of poor performance are system related: excessive swapping or background activity, slow disk drives, etc.

When a CompressedLexicon object is constructed from a file, it must load and initialize various tables from the compressed lexicon file. As words are checked, the CompressedLexicon class loads parts of the compressed lexicon file into memory, where they are cached. The first time you check the spelling of a word, the part of the compressed lexicon which (potentially) contains it is loaded into memory, resulting in a small delay. If you check the same word or a similar word again, the cached copy is checked, resulting in much higher performance. Eventually the entire compressed lexicon will be loaded into memory and no further disk I/O delays will be incurred. However, if you specify a memory budget of anything other than zero when you construct the CompressedLexicon object, the budget you specify must be large enough to hold the entire compressed lexicon or an effect similar to "swapping" will occur. If you want to load the entire compressed lexicon into memory at once, construct the CompressedLexicon object from a stream (version 5.7 or later only) or call SpellingSession's suggest method with a depth parameter of 100 (this will result in a complete search of the compressed lexicon and will load it into memory as a side effect).

Looking up suggestions for misspelled words can be a time consuming process, because it involves making fairly complex comparisons against (potentially) hundreds of thousands of words. Use the suggestion search depth to form a compromise between search accuracy and speed. Start at a low depth value (20-30). If the correct replacement isn't found, increase the depth and try again until the word is found or the maximum depth is reached.

Wintertree Software Inc.

Site index:


[Home] [Products] [Catalog] [Ordering] [Search] [Contact Us]


Copyright © 2015 Wintertree Software Inc.