Auto-complete list performance issues.

SyntaxEditor for WPF Forum

The latest build of this product (v21.1.1) was released 3 months ago, which was before this thread was created.
Posted 2 months ago by Sunshine - Appeon
Version: 21.1.1
Platform: .NET 5.0
Environment: Windows 10 (64-bit)
Avatar

I created a CompletionSession and set its filter properties:

session.CanFilterUnmatchedItems = true;
session.MatchOptions = CompletionMatchOptions.UseShorthand;

Then I added 3000 CompletionItems to this session.

After opening CompletionSession, my input can trigger list filtering. However, if there are still many filter list items at this time, there will be a freeze during the input process.

This happens only when the CanFilterUnmatchedItems property is set to'true'.

So I speculate that in the case of too many Items, there should be some performance problems in filtering.

Comments (7)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Note that UseAcronyms will add some performance penalty and UseShorthand adds a significant performance penalty when using CanFilterUnmatchedItems.  This is due to the complex regular expression matching it's having to do on each item to determine if it passes the CanFilterUnmatchedItems filter or not.  If you don't use the shorthand option, how does your typing performance look with CanFilterUnmatchedItems?


Actipro Software Support

Posted 2 months ago by Sunshine - Appeon
Avatar

The best experience so far is UseShorthand and CanFilterUnmatchedItems.

If UseAcronyms can match uppercase letters and the string immediately following it, then it can also meet the demand. But it can only match uppercase letters.

In this situation, I can only choose one of experience and performance.

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We did more performance profiling on it to verify the slowdown cause:

  • CanFilterUnmatchedItems has to run the filters on all completion list items since any text edit could potentially show/hide an item.  If you have 3,000 completion items, then every time you type, it has to run the filters 3,000 times.
  • UseShorthand has a much more time-consuming Regex to consume (compared to other matchers) since it's basically allowing any number of characters to be typed between any character in the completion item's text.  While this is very flexible for matching, it can incur significant time penalty when there are lots of completion items.
  • Our StartsWith and Acronym matchers perform much faster than Shorthand, and therefore work much better right now when paired with CanFilterUnmatchedItems.

The latest Visual Studio seems to use a modified version of our Acronym matcher where as you said, they also match letters right after a capital letter.  I've made a TODO item to possibly implement that kind of logic in the future.  I don't believe a regular expression can be used to build that kind of matcher though, so some sort of custom string comparison logic would need to be built.

On a side note, you also can build custom completion item matchers with your own logic if you wish.  The IntelliPromptCompletionCustomItemMatcher QuickStart shows one way to do this.  That sample uses a Regex, but if you want to go lower level with custom non-Regex-based logic, you can inherit CompletionItemMatcherBase instead.


Actipro Software Support

Posted 1 month ago by Sunshine - Appeon
Avatar

I solved the problem by implementing a custom matcher and filter implementation.

Another question about filtering behavior:

When all items will be filtered. How to set the currently selected state to "CompletionSelectionState.Partial" and keep the last filtered items. Instead of filtering all and displaying ‘no matchs’.

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

There isn't an option for preventing filtering down to nothing right now.  We will write down the request for one.


Actipro Software Support

Posted 13 days ago by Sunshine - Appeon
Avatar

Does CompletionSession.FilterItems support directly setting its items?

I rewrote the filtering function myself due to performance issues and I want to judge whether there is an item that meets the filter after one input.

If there is no filter item that meets the conditions, the result of the last filter will be retained.

So in this process, I already have a collection that meets the filter conditions, but it cannot be directly set to CompletionSession.FilterItems. I can only set its callback method internally to let it filter again. This caused me some performance issues.

Posted 13 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Sorry but you cannot directly set items in session.FilterItems.  It is a class that inherits ListCollectionView, which is a "view" on the session's Items collection using filters.

The filter logic for the view should only really be doing anything if you set session.CanFilterUnmatchedItems to true, or have specified session.Filters.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.