Jump to content
Sign in to follow this  
pyscripter

TRegEx Rio benchmark

Recommended Posts

One of the improvements in Delphi Rio is the upgrade of PCRE to version 8.42 and more importantly the inclusion of UTF-16 support on Windows.  What this means is that Delphi strings are no longer converted to UTF-8 and back when using Regular Expressions.  This blog post describes a benchmark of various regular expression options.   I wanted to see the impact of the Rio improvements and here are the results.   The results below use the test suite of the above mentioned article.

 

Delphi 10.2:  Total Time:    12639.00 ms

Delphi 10.3:  Total Time:    10614.00 ms (about 17% faster)

 

Further improvement can be achieved by using PCRE Study.  Fir a bit of extra compile time you have significant execution benefits.  You need a class helper to use Study with TRegEx:

type
  TRegExHelper = record helper for TRegEx
  public
    procedure Study;
  end;

procedure TRegExHelper.Study;
begin
  with Self do FRegEx.Study;
end;

You can call study after TRegEx,Create. Here are the results with Study.

 

Delphi 10.2:  Total Time:    9863.00 ms

Delphi 10.3:  Total Time:   7895.00 ms    (about 20% faster)

 

 

  • Like 2
  • Thanks 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×