From: "Mauricio Fernández" Date: 2005-07-16T07:26:08+09:00 Subject: Re: [QUIZ] Sampling (#39) On Sat, Jul 16, 2005 at 06:30:15AM +0900, Ezra Zygmuntowicz wrote: > > On Jul 15, 2005, at 1:27 PM, jason r tibbetts wrote: > >I /really/ want to know how this is possible. Multi-processor > >solution? > > > Nope This is running on a single 1.6Ghz G5 tower with about 15 other > programs running including photoshop and dreamweaver. And my solution > is only 9 lines of code ;-) Here's some more results with a little > more time shaved off: > ezra:~/Sites/______raill_stuff ez$ time ./sample.rb 5_000_000 > 1_000_000_000 > big_sample.txt > > real 0m39.860s > user 0m34.343s > sys 0m1.370s My first take is also 9L long. Timed on a 1536.849MHz K7 with only a couple processes awake, out of 150+. batsman@tux-chan:/tmp$ time ruby sample.rb 5_000_000 1_000_000_000 > big_sample.txt real 0m33.880s user 0m32.750s sys 0m0.610s batsman@tux-chan:/tmp$ ls -l big_sample.txt -rw-r--r-- 1 batsman batsman 49442396 2005-07-16 00:19 big_sample.txt batsman@tux-chan:/tmp$ tail big_sample.txt 999997948 999998026 999998293 999998375 999998678 999998872 999999237 999999555 999999632 999999719 batsman@tux-chan:/tmp$ head big_sample.txt 103 260 521 857 1009 1395 1505 1896 2140 2302 -- Mauricio Fernandez