diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2015-12-10 18:35:34 -0500 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-01-07 10:25:16 +1100 |
commit | 8f1332ed63eb9a2061410b390e383415d456a7f4 (patch) | |
tree | 5aacbffde70e7be508d711fe7961691d54fc9352 /win32/win32.c | |
parent | a98780ae0779fdda8d6c2bc706475093056a92bf (diff) | |
download | perl-8f1332ed63eb9a2061410b390e383415d456a7f4.tar.gz |
give Win32 miniperl a real getcwd for build perf
getcwd() is now 605x faster for Win32 miniperl.
------------------------------
use Cwd;
Cwd::getcwd() for(0..10000);
------------------------------
before
C:\p523\src\win32>timeit -f t.dat ..\miniperl -I..\lib t.pl
Version Number: Windows NT 6.1 (Build 7601)
Exit Time: 2:03 am, Thursday, December 10 2015
Elapsed Time: 0:01:12.438
Process Time: 0:00:14.289
System Calls: 5802378
Context Switches: 1455066
Page Faults: 5250724
Bytes Read: 76809789
Bytes Written: 5278717
Bytes Other: 10407004
after
C:\p523\src\win32>timeit -f t.dat ..\miniperl -I..\lib t.pl
Version Number: Windows NT 6.1 (Build 7601)
Exit Time: 1:20 am, Thursday, December 10 2015
Elapsed Time: 0:00:00.119
Process Time: 0:00:00.124
System Calls: 4658
Context Switches: 540
Page Faults: 1127
Bytes Read: 99074
Bytes Written: 0
Bytes Other: 12888
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 1f6bd9102a..b410f662cd 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4232,6 +4232,35 @@ XS(w32_SetChildShowWindow) XSRETURN(1); } + +#ifdef PERL_IS_MINIPERL +/* shelling out is much slower, full perl uses Win32.pm */ +XS(w32_GetCwd) +{ + dXSARGS; + /* Make the host for current directory */ + char* ptr = PerlEnv_get_childdir(); + /* + * If ptr != Nullch + * then it worked, set PV valid, + * else return 'undef' + */ + if (ptr) { + SV *sv = sv_newmortal(); + sv_setpv(sv, ptr); + PerlEnv_free_childdir(ptr); + +#ifndef INCOMPLETE_TAINTS + SvTAINTED_on(sv); +#endif + + ST(0) = sv; + XSRETURN(1); + } + XSRETURN_UNDEF; +} +#endif + void Perl_init_os_extras(void) { @@ -4253,6 +4282,9 @@ Perl_init_os_extras(void) #endif newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); +#ifdef PERL_IS_MINIPERL + newXS("Win32::GetCwd", w32_GetCwd, file); +#endif } void * |