- or download this
$ alias tperl="time perl -w -Mthreads -Mthreads::shared"
...
CPU 2.272 secs (CPU 1.316 secs)
$ tperl -e'my @x=(1..35_000);threads->create(sub{})->join() for 1..10
+0'
CPU 3.304 secs (CPU 3.384 secs)
- or download this
$ tperl -e'my @x=(1..35_000);threads->create(sub{for(@x){my$y=$_}})->
+join() for 1..100'
CPU 4.324 secs
$ tperl -e'my @x;share(@x);@x=(1..35_000);threads->create(sub{for(@x)
+{my$y=$_}})->join() for 1..100'
CPU 17.281 secs
- or download this
$ tperl -e'fork && exit for 1..100'
CPU 0.044 secs (CPU 0.020 secs)
...
CPU 0.072 secs (CPU 0.072 secs)
$ tperl -e'my @x=(1..35_000);for(1..100){if(fork){for(@x){my$y=$_};ex
+it}}'
CPU 0.084 secs
- or download this
# Try to load the data late but mostly fail:
$ tperl -e'threads->create(sub{})->join() for 1..100;my @x=(1..35_000
+)'
...
Use of uninitialized value in concatenation (.) or string at -e line 1
+.
()
CPU 3.380 secs (CPU 2.128 secs)