Skip Menu |
Report information
Id: 121906
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: bulk88 <bulk88 [at] hotmail.com>
Cc:
AdminCc:

Operating System: mswin32
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.19.7
Fixed In: (no value)



Date: Sat, 17 May 2014 22:43:27 -0400
To: perlbug [...] perl.org
Subject: [PATCH] refactor pp_list
From: bulk88 <bulk88 [...] hotmail.com>
Download (untitled) / with headers
text/plain 8.5k
This is a bug report for perl from bulk88@hotmail.com, generated with the help of perlbug 1.39 running under perl 5.19.7. ----------------------------------------------------------------- [Please describe your issue here] See attached patch. Main point of the patch is to move read and writes that happened global/all branches, into the branch were they are required, and therefore less asm ops execute if "GIMME == G_ARRAY". This was the 8th hottest opcode in a personal script I ran. I tried to do some profiling with a script that calls pp_list ~70000 times per process then dumps the average at the end but any difference below Win32's QueryPerformanceCounter's precision. If anyone is interested I can attach the patches used to generate the numbers below. how to read, float is time in us, 2nd number is CPU ticks for calling pp_list, 3rd number is overhead of QPC, 2 calls to QPC 1 after another then subtracted, 2nd number HAS NOT been subtracted from 3rd before avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.333333 10 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.333333 10 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.666667 11 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 4 after avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 3.666667 11 5 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 4.666667 14 7 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 5 avg is 3.333333 10 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 2.666667 8 5 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 4 avg is 3.000000 9 5 avg is 3.000000 9 4 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 3.000000 9 5 avg is 2.666667 8 5 avg is 2.666667 8 4 avg is 2.666667 8 5 avg is 3.000000 9 4 avg is 2.666667 8 5 avg is 3.000000 9 4 [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.19.7: Configured by Owner at Thu Nov 28 02:32:44 2013. Summary of my perl5 (revision 5 version 19 subversion 7) configuration: Derived from: 8f47723e28b75530b743941cdd8b07f849ec48e2 Ancestor: 1061065f7a09399eefb50e9a035502621722bcc0 Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -G7 -GL -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_HASH_FUNC_ONE_AT_A_TIME -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T', optimize='-O1 -MD -Zi -DNDEBUG -G7 -GL', cppflags='-DWIN32' ccversion='13.10.6030', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl519\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib" libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl519.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl519\lib\CORE" -machine:x86' Locally applied patches: uncommitted-changes 8f47723e28b75530b743941cdd8b07f849ec48e2 --- @INC for perl 5.19.7: C:/perl519/site/lib C:/perl519/lib . --- Environment for perl 5.19.7: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\perl519\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem; PERL_BADLANG (unset) SHELL (unset)
From 5b1fb5914dd2ffb35ae3286bcf8e8ee236940710 Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Sat, 17 May 2014 22:10:01 -0400 Subject: [PATCH] refactor pp_list -move PL_stack_sp and PL_stack_base reads into the branch in which they are used, this also removes 1 var from being saved across the function call in GIMME, which removes saving and restoring 1 non-vol register -write SP to PL_stack_sp (PUTBACK) only if it was changed -POPMARK is mutable, it must execute on all branches this reduced pp_list's machine code size of the function from 0x58 to 0x53 bytes on VC 2003 -01 32 bits --- pp.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pp.c b/pp.c index 4ec6887..662756e 100644 --- a/pp.c +++ b/pp.c @@ -4847,15 +4847,19 @@ PP(pp_kvhslice) PP(pp_list) { - dVAR; dSP; dMARK; + dVAR; + I32 markidx = POPMARK; if (GIMME != G_ARRAY) { + SV **mark = PL_stack_base + markidx; + dSP; if (++MARK <= SP) *MARK = *SP; /* unwanted list, return last item */ else *MARK = &PL_sv_undef; SP = MARK; + PUTBACK; } - RETURN; + return NORMAL; } PP(pp_lslice) -- 1.7.9.msysgit.0
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 352b
On Sat May 17 19:44:14 2014, bulk88 wrote: Show quoted text
> See attached patch. > > Main point of the patch is to move read and writes that happened > global/all branches, into the branch were they are required, and > therefore less asm ops execute if "GIMME == G_ARRAY". This was the 8th > hottest opcode in a personal script I ran.
Added to 5.21.1 blockers. Tony
RT-Send-CC: perl5-porters [...] perl.org
Thanks, applied locally, tests running. Will push to blead shortly.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 177b
On Wed May 28 01:09:55 2014, smueller@cpan.org wrote: Show quoted text
> Thanks, applied locally, tests running. Will push to blead shortly.
Applied as 4fa715fa94837500ba695881194771a669c480ff.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org