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

[perl #121330] pp_sleep optree optimization wishlist

Thread Next
From:
bulk88
Date:
February 26, 2014 21:57
Subject:
[perl #121330] pp_sleep optree optimization wishlist
Message ID:
rt-4.0.18-3022-1393451809-1224.121330-75-0@perl.org
# New Ticket Created by  bulk88 
# Please include the string:  [perl #121330]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=121330 >


This is a bug report for perl from bulk88@hotmail.com,
generated with the help of perlbug 1.40 running under perl 5.19.9.


-----------------------------------------------------------------
[Please describe your issue here]

Looking at pp_sleep in 5.19.
-----------------------
PP(pp_sleep)
{
     dVAR; dSP; dTARGET;
     I32 duration;
     Time_t lasttime;
     Time_t when;

     (void)time(&lasttime);
     if (MAXARG < 1 || (!TOPs && !POPs))
	PerlProc_pause();
     else {
	duration = POPi;
	PerlProc_sleep((unsigned int)duration);
     }
     (void)time(&when);
     XPUSHi(when - lasttime);
     RETURN;
}
-----------------------
It has no bypass for not returning or calculating the sleep time AFAIK 
since it uses dTARGET and PUSHi. Also a more extreme optimization is 
creating a "guarenteed 1 @_ arg" sleep opcode and a separate pause 
opcode.  Below is a Concise dump.
-----------------------
sub mysubnowarn {
     sleep 5;
     return 1;
}
my $walker = B::Concise::compile('-src','-exec', *mysubnowarn{CODE});
$walker->();
-----------------------
C:\Documents and Settings\Owner\Desktop>perl n11.pl
B::Concise::compile(CODE(0x8fce7c))
# 69:     sleep 5;
1  <;> nextstate(main -8 n11.pl:69) v
2  <$> const[IV 5] s
3  <1> sleep[t1] vK/1
# 70:     return 1;
4  <;> nextstate(main -8 n11.pl:70) v
5  <$> const[IV 1] s
6  <1> leavesub[1 ref] K/REFC,1

C:\Documents and Settings\Owner\Desktop>
-----------------------
IDK what the "/1" op flag on the sleep op means. v means the op already 
knows it is a void context and doesn't need to return anything.


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=wishlist
---
Site configuration information for perl 5.19.9:

Configured by Owner at Wed Feb 12 06:47:30 2014.

Summary of my perl5 (revision 5 version 19 subversion 9) configuration:
Derived from: 633f0fd2ca244ca83cc99b3af3a7d3ac2931850b
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
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -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='-Od -MD -Zi -DDEBUGGING',
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
-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
-libpath:"c:\perl519\lib\CORE" -machine:x86'

Locally applied patches:
uncommitted-changes

---
@INC for perl 5.19.9:
C:/perl519/site/lib
C:/perl519/lib
.

---
Environment for perl 5.19.9:
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)



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