in reply to Why is Windows 100 times slower than Linux when growing a large scalar?
Compiling perl 5.10.1 without USE_IMP_SYS and with USE_PERL_MALLOC makes a huge difference. The following script grows two strings, each in a separate thread, to 1/2GB in 1000-byte increments in a little under 2 1/2 seconds:
#! perl -slw use strict; use Time::HiRes qw[ time ]; use threads; <>; my $start = time; async { my $s = chr(0) x 1000; for( 1 .. 5e5 ) { $s .= chr( 0 ) x 1000; } }->detach; my $s = chr(0) x 1000; for( 1 .. 5e5 ) { $s .= chr( 0 ) x 1000; } printf "Re-allocated 2 x 500MB (in 1000 byte incements) on two threads + in %.3f\n", time() - $start; <>; __END__ C:\perl\5.10.1\bin>.\perl.exe \test\mem.pl Re-allocated 2 x 500MB (in 1000 byte incements) on two threads in 2.41 +6
Now the question is: why is USE_IMP_SYS required for fork emulation? And can that be corrected?
Cluebats welcomed. Along with any thoughts on more thorough testing of Perl_malloc and threading.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Why is Windows 100 times slower than Linux when growing a large scalar?
by Anonymous Monk on Dec 01, 2009 at 21:53 UTC | |
by BrowserUk (Patriarch) on Dec 01, 2009 at 22:01 UTC | |
by BrowserUk (Patriarch) on Dec 02, 2009 at 07:40 UTC | |
by Anonymous Monk on Dec 03, 2009 at 03:43 UTC |