[racket] Thread creation slow?
I've pushed some improvements in v5.3.0.18.
On my machine (MacBook Air, 32-bit mode):
v5.3: 27.274u 5.868s 0:35.14 94.2% 0+0k 6+2io 622pf+0w
v5.3.0.18: 5.851u 2.494s 0:09.12 91.4% 0+0k 2+0io 691pf+0w
I believe that most of the savings are in corrections to avoid O(N)
setup for N threads for each minor GC.
Racket threads can be made lighter by adjusting the
`current-thread-initial-stack-size' parameter. If I change the program
to use
(parameterize ([current-thread-initial-stack-size 100])
(setup-whispers leftmost 0 100000))
then I get
3.854u 1.175s 0:05.32 94.3% 0+0k 1+1io 689pf+0w
The trade-off for a smaller initial stack size is that deeper recursion
is more expensive.
Here are results in 64-bit mode on my machine:
v5.3: 37.339u 24.869s 1:29.12 69.7% 0+0k 1+0io 49597pf+0w
v5.3.0.18: 8.948u 10.030s 0:36.29 52.2% 0+0k 2+0io 43919pf+0w
v5.3.0.18/100: 6.334u 3.317s 0:10.83 89.0% 0+0k 0+0io 0pf+0w
For the first two, there's a big difference between CPU+user time and
real time. Those configurations apparently use enough memory to
aggravate my machine's memory system.