Enable caching of strxfrm() results also for readonly SVs as
Marcus Holland-Moritz [Fri, 15 Feb 2008 17:00:15 +0000 (18:00 +0100)]
returned e.g. by "keys %hash". This speeds up sorting of lots
of hash keys significantly. See also:

Subject: Slowdown of "sort keys %hash" under "use locale"
Message-ID: <20080215170015.72f6160d@r2d2>

p4raw-id: //depot/perl@33334

sv.c

diff --git a/sv.c b/sv.c
index 2aefe3e..3d60e02 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -6494,11 +6494,6 @@ Perl_sv_collxfrm(pTHX_ SV *sv, STRLEN *nxp)
            Safefree(mg->mg_ptr);
        s = SvPV_const(sv, len);
        if ((xf = mem_collxfrm(s, len, &xlen))) {
-           if (SvREADONLY(sv)) {
-               SAVEFREEPV(xf);
-               *nxp = xlen;
-               return xf + sizeof(PL_collation_ix);
-           }
            if (! mg) {
 #ifdef PERL_OLD_COPY_ON_WRITE
                if (SvIsCOW(sv))