This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Reverse order of setting, for speed
authorKarl Williamson <public@khwilliamson.com>
Mon, 9 Jul 2012 22:17:40 +0000 (16:17 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 25 Jul 2012 03:13:48 +0000 (21:13 -0600)
It's faster to append to an inversion list than to insert into the
middle.  The previous order of doing things guaranteed that the 2nd
thing done would be an insertion, hence slower than an append.  Now we
add the lowest ordinal character first, so there is a chance that both
will be appends

regcomp.c

index bba966b..519186e 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -12084,9 +12084,9 @@ parseit:
                                 break;
                             case MICRO_SIGN:
                                 cp_list = add_cp_to_invlist(cp_list,
-                                                    GREEK_SMALL_LETTER_MU);
-                                cp_list = add_cp_to_invlist(cp_list,
                                                     GREEK_CAPITAL_LETTER_MU);
+                                cp_list = add_cp_to_invlist(cp_list,
+                                                    GREEK_SMALL_LETTER_MU);
                                 break;
                             case LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE:
                             case LATIN_SMALL_LETTER_A_WITH_RING_ABOVE: