speed up miniperl require on Win32
authorDaniel Dragan <bulk88@hotmail.com>
Sat, 1 Mar 2014 11:20:16 +0000 (06:20 -0500)
committerSteve Hay <steve.m.hay@googlemail.com>
Tue, 8 Apr 2014 12:03:47 +0000 (13:03 +0100)
These 3 optimizations reduce the number of, usually failing, I/O calls
for each "require" for miniperl only. None are appropriate except for
Win32. See #121119 for details.

win32/win32.h
write_buildcustomize.pl

index e109939..8db0303 100644 (file)
@@ -13,6 +13,7 @@
 #  define _WIN32_WINNT 0x0500     /* needed for CreateHardlink() etc. */
 #endif
 
+/* Win32 only optimizations for faster building */
 #ifdef PERL_IS_MINIPERL
 /* this macro will remove Winsock only on miniperl, PERL_IMPLICIT_SYS and
  * makedef.pl create dependencies that will keep Winsock linked in even with
@@ -20,6 +21,8 @@
  * level in full perl
  */
 #  define WIN32_NO_SOCKETS
+/* less I/O calls during each require */
+#  define PERL_DISABLE_PMC
 #endif
 
 #ifdef WIN32_NO_SOCKETS
index 64bf4ce..cf429a9 100644 (file)
@@ -54,7 +54,10 @@ require File::Spec::Functions;
 
 my $inc = join ",\n        ",
     map { "q\0$_\0" }
-    (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib');
+    (map {File::Spec::Functions::rel2abs($_)} (
+# faster build on the non-parallel Win32 build process
+        $^O eq 'MSWin32' ? ('lib', @toolchain ) : (@toolchain, 'lib')
+    ));
 
 open my $fh, '>', $file
     or die "Can't open $file: $!";
@@ -74,6 +77,7 @@ print $fh <<"EOT" or $error = "Can't print to $file: $!";
 # We are miniperl, building extensions
 # Replace the first entry of \@INC ("lib") with the list of
 # directories we need.
+${\($^O eq 'MSWin32' ? '${^WIN32_SLOPPY_STAT} = 1;':'')}
 splice(\@INC, 0, 1, $inc);
 \$^O = '$osname';
 EOT