New Regular Expression filter feedback

Arffeh's profile image Arffeh posted 5 years ago in Feature discussion Permalink

Hello,

When deleting the contents of the new Regular Expression filter below the results table, it seems like it's actually attempting to apply a regex filter of "" (blank), rather than just discarding->resetting the view, which theoretically should be fairly fast.

This is noticeable when applying a filter on a large result-set. For example, a filter that takes 20 seconds to execute, also takes that long upon deleting it to show the full set again.

ansgar's profile image ansgar posted 5 years ago Permalink

No, the regular expression is not executed when it's empty. The code for it looks like this:

while Assigned(Node) do begin
    // Don't filter anything if the filter text is empty
    match := rx.Expression = '';
    // Search for given text in node's captions
    if not match then for i := 0 to VT.Header.Columns.Count - 1 do begin
      CellText := VT.Text[Node, i];
      match := rx.Exec(CellText);
      if match then
        break;
    end;
    VT.IsVisible[Node] := match;
    if match then
      inc(VisibleCount);
    Node := VT.GetNext(Node);
  end;

What does take a bit is this one:

VT.IsVisible[Node] := match

Probably I can make it faster by wrapping the loop in a BeginUpdate/EndUpdate block, to postpone message processing to later.

Code modification/commit 94ae69e from Ansgar Becker <anse@heidisql.com>, 5 years ago, revision 9.5.0.5398
Wrap filtering grid data in BeginUpdate/EndUpdate, so it might get a bit faster. See https://www.heidisql.com/forum.php?t=26181
ansgar's profile image ansgar posted 5 years ago Permalink

Just done that. Please check the upcoming new build.

Please login to leave a reply, or register at first.