Sentry Spelling Checker Engine - Support
You are here: Home > Support > Sentry Spelling Checker Engine > Solving performance problems
Product: Sentry Spelling Checker Engine (Windows and Source SDKs)
The Sentry spelling engine is designed and built for high performance. This document contains some tips for making Sentry run as quickly as possible.
Open dictionaries (lexicons) as local files. Accessing lexicon files across a network can decrease performance, since network file access is many times slower than local file access, especially over congested networks.
Open dictionaries containing frequently used words first. Sentry searches for words in the order in which dictionaries are opened, and stops searching once a word is found. Opening a dictionary containing words that appear frequently (such as the, of, and a) first reduces the time required to locate these words and improves overall performance. This is what the "ssceam.tlx" (or "sscebr.tlx", etc.) files are for: They contain the words that occur most often, and therefore should be opened first.
Open dictionaries for one language at a time. The more dictionary files Sentry must search through, the longer the search will take, particularly when locating suggestions. Don't open the American and British English dictionaries together, for example.
Load an entire compressed dictionary into memory. When a compressed (.clx) dictionary file is opened, Sentry loads certain information from the file into memory, but does not load any words. This reduces the time required to open the dictionary. While checking spelling or looking up suggestions, Sentry loads portions of the compressed dictionary into memory and caches them. Once a portion of the dictionary has been loaded, it is thereafter accessed in memory. A delay is therefore incurred at run-time when a portion of the dictionary must be loaded from disk. In some applications, incurring a longer delay when opening the dictionary is preferable to incurring many short delays (while portions of the dictionary are loaded into memory). In these situations, the entire compressed dictionary can be loaded into memory at once by calling the SSCE_Suggest and passing a depth value of 100 (it doesn't matter what word you locate suggestions for).
If you open dictionaries using SSCE_OpenLex, and have memory available, pass 0 as the memory-budget parameter. This permits Sentry to use as much memory as necessary when caching the dictionary. The maximum amount of memory used will be roughly equivalent to the dictionary's file size.
If you have a text dictionary containing more than 5000 words, compress the word list using SQLEX to reduce the time required to load the dictionary.
Locating suggestions using the typographical algorithm is generally faster than using the phonetic algorithm.
Locating suggestions using either the typographical algorithm or the phonetic algorithm is faster than using both algorithms at the same time.
The depth parameter passed to the SSCE_Suggest function has a direct bearing on the amount of time the function will run. Unfortunately, there is no simple way to determine in advance the minimum depth value needed for SSCE_Suggest to locate a correct spelling. When the typographical suggestion algorithm is used, the SSCE_Suggest function will find the correct replacement for a misspelled word containing a single error at depth 30 (assuming the correct spelling is in an open dictionary, and that the buffer passed to SSCE_Suggest is large enough to hold all words that are good candidates). In situations where a person can review the set of suggestions to determine if the correct spelling was found, a good approach is to call SSCE_Suggest at depth 30 and give the user a means to call it again at successively higher depths (increasing by, say, 10 each time) until the correct spelling is located.
Enable case sensitivity. The Sentry engine and dictionaries work fastest when the case-sensitive option is enabled. Disabling case sensitivity may reduce performance by as much as a factor of four. In situations where case-sensitivity is undesirable (e.g., text is entered in all-caps), better performance may be achieved by converting the text to all lower case, setting SSCE_REPORT_UNCAPPED_OPT, and ignoring any misspelled words reported with SSCE_UNCAPPED_WORD_RSLT.
Make sure SSCE_ALLOW_ACCENTED_CAPS_OPT is enabled, unless you are checking French Canadian text using Wintertree Software's French dictionary. Disabling this option will degrade performance severely when checking text containing capital letters.
Copyright © 2015 Wintertree Software Inc.