From: Bill Kelly Date: 2006-02-09T06:59:44+09:00 Subject: Re: Sandboxing eval'd code From: "Erik Veenstra" > >$ time ruby -e '(1..100000).collect{Thread.new{sleep 1}}.collect{|t| t.join}' > > real 0m42.583s > user 0m37.693s > sys 0m1.828s > > $ time ruby -e '(1..100000).collect{Thread.new{}.join}' > > real 0m4.683s > user 0m3.984s > sys 0m0.245s > > In the latter situation, the threads are not living side-by-side. > The second thread is started when the first one has finished. > > The first example starts a lot of threads concurrently. Right. I didn't mean to imply having thousands of live threads was equivalent to having one thread created and deleted serially. In the $SAFE/eval situation, I presumed the usage would be like the former: create one thread, and ask for its value. Regards, Bill