This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp.c: tiny performance enhancement
authorKarl Williamson <public@khwilliamson.com>
Mon, 15 Nov 2010 17:49:52 +0000 (10:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 22 Nov 2010 21:32:55 +0000 (13:32 -0800)
I believe on many processors two increments are faster than two
additions

pp.c

diff --git a/pp.c b/pp.c
index ca73573..e4da3d2 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -4153,10 +4153,10 @@ PP(pp_uc)
 
                /* Likewise, if it fits in a byte, its case change is in our
                 * table */
-               U8 orig = TWO_BYTE_UTF8_TO_UNI(*s, *(s+1));
+               U8 orig = TWO_BYTE_UTF8_TO_UNI(*s, *s++);
                U8 upper = toUPPER_LATIN1_MOD(orig);
                CAT_TWO_BYTE_UNI_UPPER_MOD(d, orig, upper);
-               s += 2;
+               s++;
            }
            else {
 #else
@@ -4391,9 +4391,9 @@ PP(pp_lc)
            else if (UTF8_IS_DOWNGRADEABLE_START(*s)) {
 
                /* As do the ones in the Latin1 range */
-               U8 lower = toLOWER_LATIN1(TWO_BYTE_UTF8_TO_UNI(*s, *(s+1)));
+               U8 lower = toLOWER_LATIN1(TWO_BYTE_UTF8_TO_UNI(*s, *s++));
                CAT_UNI_TO_UTF8_TWO_BYTE(d, lower);
-               s += 2;
+               s++;
            }
            else {
 #endif