This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regex: Speed up \X processing
authorKarl Williamson <public@khwilliamson.com>
Tue, 21 Aug 2012 04:03:22 +0000 (22:03 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sun, 26 Aug 2012 05:21:30 +0000 (23:21 -0600)
commita1853d78a51dcd1a14b408d87ce27e98b6fc8a23
treefcd83e81ff3c9a485c5644111acdfb48dd61acd9
parent971d486f115af743c94b65d0d90c23a6541bb7d2
regex: Speed up \X processing

For most Unicode releases, GCB=prepend matches absolutely nothing.  And
that appears to be the case going forward, as they added things to it,
and removed them later based on field experience.

An earlier commit has improved the performance of this significantly by
using a binary search of an empty array instead of a swash hash.
However, that search requires several layers of function calls to
discover that it is empty, which this commit avoids.

This patch will use whatever swash_init() returns unless it is empty,
preserving backwards compatibility with older Unicode releases.  But if
it is empty, the routine sets things up so that future calls will always
fail without further testing.
regexec.c
utf8.c