develooper Front page | perl.perl5.porters | Postings from September 2017

[perl #132171] Minor speedup improvement for pp_require

Thread Previous | Thread Next
From:
Atoomic via RT
Date:
September 26, 2017 23:21
Subject:
[perl #132171] Minor speedup improvement for pp_require
Message ID:
rt-4.0.24-13716-1506468061-1159.132171-15-0@perl.org
Just ran some basic benchmark with/without the patch on top of blead=dc41635313 using Porting/bench.pl tool and the following command:

./perl -Ilib Porting/bench.pl --benchfile=../benchmark-tests ../perl2/perl=blead ./perl=blead+patch

Of course, the result highly depends on the test used, I try to provide some basic scenarii with short and long module names existing or not.

Feel free to comment on it

On Tue, 26 Sep 2017 16:16:26 -0700, atoomic@cpan.org wrote:
> This is a bug report for perl from atoomic@cpan.org,
> generated with the help of perlbug 1.40 running under perl 5.27.5.
> 
> 
> -----------------------------------------------------------------
> 
> notice that doing an extra INC check before calling require can
> improve the
> performance if the module is already loaded
> 
> The idea of this commit is to check INC earlier if possible, by
> avoiding
> the IS_SAFE_PATHNAME check in S_require_file called by pp_require.
> 
> Would add some benchmark in a future message to show the improvements.
> 
> > echo 'package Foo; 1;' > lib/Foo.pm
> > time ./perl -Ilib -E 'for (1..100000000) { require Foo unless
> $INC{"Foo.pm"} } '
> 
> real    0m5.345s
> user    0m5.334s
> sys 0m0.010s
> > time ./perl -Ilib -E 'for (1..100000000) { require Foo } '
> 
> real    0m5.847s
> user    0m5.840s
> sys 0m0.008s
> 
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=low
> ---
> Site configuration information for perl 5.27.5:
> 
> Configured by root at Tue Sep 26 16:44:50 CDT 2017.
> 
> Summary of my perl5 (revision 5 version 27 subversion 5)
> configuration:
>   Derived from: c5aa55acda5cf2c353de76e6be8188e79f1f60cc
>   Platform:
>     osname=linux
>     osvers=3.10.0-693.2.2.el7.x86_64
>     archname=x86_64-linux
>     uname='linux nico-c7.dev.cpanel.net 3.10.0-693.2.2.el7.x86_64 #1
> smp
> tue sep 12 22:26:13 utc 2017 x86_64 x86_64 x86_64 gnulinux '
>     config_args='-Dusedevel -des'
>     hint=recommended
>     useposix=true
>     d_sigaction=define
>     useithreads=undef
>     usemultiplicity=undef
>     use64bitint=define
>     use64bitall=define
>     uselongdouble=undef
>     usemymalloc=n
>     default_inc_excludes_dot=define
>     bincompat5005=undef
>   Compiler:
>     cc='cc'
>     ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-
> strong
> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -D_FORTIFY_SOURCE=2'
>     optimize='-O2'
>     cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-
> strong
> -I/usr/local/include'
>     ccversion=''
>     gccversion='4.8.5 20150623 (Red Hat 4.8.5-16)'
>     gccosandvers=''
>     intsize=4
>     longsize=8
>     ptrsize=8
>     doublesize=8
>     byteorder=12345678
>     doublekind=3
>     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='cc'
>     ldflags =' -fstack-protector-strong -L/usr/local/lib'
>     libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64
> /lib
> /lib64 /usr/lib64 /usr/local/lib64
>     libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
> -lgdbm_compat
>     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
>     libc=libc-2.17.so
>     so=so
>     useshrplib=false
>     libperl=libperl.a
>     gnulibc_version='2.17'
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs
>     dlext=so
>     d_dlsymun=undef
>     ccdlflags='-Wl,-E'
>     cccdlflags='-fPIC'
>     lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
> 
> Locally applied patches:
>     uncommitted-changes
> 
> ---
> @INC for perl 5.27.5:
>     lib
>     /root/.dotfiles/perl-must-have/lib
>     /root/perl5/lib/perl5/
>     /usr/local/lib/perl5/site_perl/5.27.5/x86_64-linux
>     /usr/local/lib/perl5/site_perl/5.27.5
>     /usr/local/lib/perl5/5.27.5/x86_64-linux
>     /usr/local/lib/perl5/5.27.5
> 
> ---
> Environment for perl 5.27.5:
>     HOME=/root
>     LANG=en_US.UTF-8
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
> 
> PATH=/usr/local/cpanel/3rdparty/perl/526/bin:/usr/local/cpanel/3rdparty/perl/524/bin:/usr/local/cpanel/3rdparty/perl/522/bin:/usr/local/cpanel/3rdparty/perl/514/bin:/usr/local/cpanel/3rdparty/bin:/root/bin/:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/root/.dotfiles/bin:/root/perl5/bin:/root/.rvm/bin:/root/bin
>     PERL5DB=use Devel::NYTProf
>     PERL5LIB=/root/.dotfiles/perl-must-
> have/lib::/root/perl5/lib/perl5/
>     PERL_BADLANG (unset)
>     PERL_CPANM_OPT=--quiet
>     SHELL=/bin/bash


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=132171

Thread Previous | Thread Next


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