develooper Front page | perl.perl5.porters | Postings from August 2014

[perl #122629] [PATCH] sv_grow: performance improvement for short strings

Thread Previous
From:
rurban @ cpanel . net
Date:
August 27, 2014 18:03
Subject:
[perl #122629] [PATCH] sv_grow: performance improvement for short strings
Message ID:
rt-4.0.18-2262-1409162604-634.122629-75-0@perl.org
# New Ticket Created by  rurban@cpanel.net 
# Please include the string:  [perl #122629]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122629 >


This is a bug report for perl from rurban@cpanel.net,
generated with the help of perlbug 1.40 running under perl 5.21.4.


-----------------------------------------------------------------
sv_grow: performance improvement for short strings

Rationale:    
Empty COW strings with CUR=0 ended up allocated with LEN=10.
Now with the small part +2 they are rounded up to 4 or 8.
Overallocation of larger strings (esp. windows realloc) is
not affected by the small part. +10 stroke me as very odd.
    
Timings with different numbers:
    +0   16.394324103 +-0.27%
    +2   16.114379842 +-0.01%
    +4   16.305622265 +-1.03%
    +8   16.337438609 +-1.30%
    +10  16.675009468 +-0.59%
with LD_LIBRARY_PATH=`pwd` perf stat -r2 ./perl t/harness t/op/*.t
    
    +2 was consistently the best number, and +10 the worst. 
    +0,+4,+8 was about the same.

All tests:
+10: (u=7.09  s=1.38  cu=336.32  cs=10.59)
+8:  (u=6.86  s=1.72  cu=335.03  cs=10.48)
+2:  (u=6.46  s=1.11  cu=331.08  cs=10.28)
+0:  (u=6.67  s=1.35  cu=338.26  cs=10.74)

-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
    Type=Patch
    PatchStatus=HasPatch
---
Site configuration information for perl 5.21.4:

Configured by rurban at Wed Aug 27 11:43:16 CDT 2014.

Summary of my perl5 (revision 5 version 21 subversion 4) configuration:
  Derived from: f410e802720b8edaf0128f0af008ac504e9d98bf
  Platform:
    osname=linux, osvers=3.14-2-amd64, archname=x86_64-linux
    uname='linux reini 3.14-2-amd64 #1 smp debian 3.14.13-2 (2014-07-24) x86_64 gnulinux '
    config_args='-des -Dusedevel -Uversiononly -Dinstallman1dir=none -Dinstallman3dir=none -Dinstallsiteman1dir=none -Dinstallsiteman3dir=none -Uuseithreads -Accflags=-msse4.2 -Accflags=-march=corei7 -Dcf_email=rurban@cpanel.net -Dperladmin=rurban@cpanel.net -Duseshrplib -Dcc=gcc-4.9 -Dld=gcc-4.9'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc-4.9', ccflags ='-msse4.2 -march=corei7 -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-msse4.2 -march=corei7 -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.9.1', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc-4.9', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/lib/perl5/5.21.4/x86_64-linux/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    uncommitted-changes

---
@INC for perl 5.21.4:
    lib
    /usr/local/lib/perl5/site_perl/5.21.4/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.21.4
    /usr/local/lib/perl5/5.21.4/x86_64-linux
    /usr/local/lib/perl5/5.21.4
    /usr/local/lib/perl5/site_perl/5.21.3
    /usr/local/lib/perl5/site_perl/5.21.2
    /usr/local/lib/perl5/site_perl/5.21.1
    /usr/local/lib/perl5/site_perl/5.21.0
    /usr/local/lib/perl5/site_perl/5.20.1
    /usr/local/lib/perl5/site_perl/5.20.0
    /usr/local/lib/perl5/site_perl/5.19.11
    /usr/local/lib/perl5/site_perl/5.19.10
    /usr/local/lib/perl5/site_perl/5.19.9
    /usr/local/lib/perl5/site_perl/5.19.8
    /usr/local/lib/perl5/site_perl/5.19.7
    /usr/local/lib/perl5/site_perl/5.19.6
    /usr/local/lib/perl5/site_perl/5.19.5
    /usr/local/lib/perl5/site_perl/5.19.4
    /usr/local/lib/perl5/site_perl/5.19.3
    /usr/local/lib/perl5/site_perl/5.19.2
    /usr/local/lib/perl5/site_perl/5.19.1
    /usr/local/lib/perl5/site_perl/5.19.0
    /usr/local/lib/perl5/site_perl/5.18.2
    /usr/local/lib/perl5/site_perl/5.18.1
    /usr/local/lib/perl5/site_perl/5.18.0
    /usr/local/lib/perl5/site_perl/5.17.11
    /usr/local/lib/perl5/site_perl/5.17.10
    /usr/local/lib/perl5/site_perl/5.17.8
    /usr/local/lib/perl5/site_perl/5.17.7
    /usr/local/lib/perl5/site_perl/5.17.6
    /usr/local/lib/perl5/site_perl/5.17.5
    /usr/local/lib/perl5/site_perl/5.17.4
    /usr/local/lib/perl5/site_perl/5.17.3
    /usr/local/lib/perl5/site_perl/5.17.2
    /usr/local/lib/perl5/site_perl/5.17.1
    /usr/local/lib/perl5/site_perl/5.17.0
    /usr/local/lib/perl5/site_perl/5.17
    /usr/local/lib/perl5/site_perl/5.16.3
    /usr/local/lib/perl5/site_perl/5.16.2
    /usr/local/lib/perl5/site_perl/5.16.1
    /usr/local/lib/perl5/site_perl/5.16.0
    /usr/local/lib/perl5/site_perl/5.15.9
    /usr/local/lib/perl5/site_perl/5.15.8
    /usr/local/lib/perl5/site_perl/5.15.7
    /usr/local/lib/perl5/site_perl/5.15.6
    /usr/local/lib/perl5/site_perl/5.15.5
    /usr/local/lib/perl5/site_perl/5.15.4
    /usr/local/lib/perl5/site_perl/5.15.3
    /usr/local/lib/perl5/site_perl/5.15.2
    /usr/local/lib/perl5/site_perl/5.14.4
    /usr/local/lib/perl5/site_perl/5.14.3
    /usr/local/lib/perl5/site_perl/5.14.2
    /usr/local/lib/perl5/site_perl/5.14.1
    /usr/local/lib/perl5/site_perl/5.12.5
    /usr/local/lib/perl5/site_perl/5.12.4
    /usr/local/lib/perl5/site_perl/5.10.1
    /usr/local/lib/perl5/site_perl/5.8.9
    /usr/local/lib/perl5/site_perl/5.8.8
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.5
    /usr/local/lib/perl5/site_perl/5.8.4
    /usr/local/lib/perl5/site_perl/5.8.3
    /usr/local/lib/perl5/site_perl/5.8.2
    /usr/local/lib/perl5/site_perl/5.8.1
    /usr/local/lib/perl5/site_perl/5.6.2
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl 5.21.4:
    HOME=/home/rurban
    LANG=en_US.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/src/perl/blead/perl-git
    LOGDIR (unset)
    PATH=/home/rurban/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About