New Regular Expression filter feedback

Arffeh posted 3 months ago in Feature discussion

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 posted 3 months ago

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.

ansgar posted 3 months ago

Just done that. Please check the upcoming new build.

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