Keywords and Startswith

SyntaxEditor for Windows Forms Forum

Posted 20 years ago by Marianne
Most of the language samples provided break down the Keywords into three groups via startswith: A-H I-R S-Z, for example.

Are you recommending that all languages break down larger keyword groups into three distinct entries? Are there performance issues if all keywords are in a single PatternGroup? If so, what about putting all keywords in their own group A-A, B-B? Would that signficantly enhance performance? I'm sure at some point there's a break even point on the SyntaxEditor creating and working with each different group vs. isolating groups of keywords. Just trying to get a sense what the break even point is.

------------------------------- Marianne

Comments (1)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA

The Optimization topic in the help discusses some of this. Be sure to check that out.

Since 2.0 now uses an NFA scanner, it will try matching each pattern until a match is found. Therefore, while putting a large amount of keywords in a single pattern group will work, it will be slow if say perhaps you are trying to match the last keyword in the group. The StartsWith provides a way for you to skip over an entire pattern group of keywords if you know that the next letter does not begin any of them, thus not spending time scanning keywords you know it will not match.

As you said, there is a break even point but it really depends on the language. You have to do time trials to determine what is the most optimized setup.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.