On Sun, Jul 17, 2005 at 12:47:33PM +0900, Bill Kelly wrote: > From: "Joost Diepenmaat" <joost / zeekat.nl> > > > > On Sun, Jul 17, 2005 at 05:23:09AM +0900, Joost Diepenmaat wrote: > > > On Sun, Jul 17, 2005 at 05:01:02AM +0900, Bill Kelly wrote: > > > > From: "Olaf Klischat" <klischat / cs.tu-berlin.de> > > > > > > > > > > See? One number per 200-numbers interval. Every time[1]. This hints at > > > > > a wrong implementation. > > > > > > > > I used the same approach. I wasn't sure if it was legal > > > > or not. But it was sure easy... :) > > > > > > I'm sure it was :-) > > > > > > I'm now down to 1.24 seconds without "cheating": > > > > erm, make that 1 MINUTE 24 seconds. I'm not *that* good :-) > > I *think* I've got a non-cheating one (I'll leave that to > y'all to decide later) that runs in: > > $ time ruby sample-c.rb 5_000_000 1_000_000_000 > big_sample-c.txt > real 0m55.169s > user 0m53.860s > sys 0m1.210s > > on the 2.4GHz Celeron system. Hmmm... I've had a few insights and I'm now down to time ./sample2 5_000_000 1_000_000_000 >big.txt real 0m44.134s user 0m42.760s sys 0m0.891s also on a 2.5Ghz Celeron head big.txt 22 40 246 382 591 683 704 789 1797 1857 tail big.txt 999997650 999997651 999997907 999998021 999998375 999998984 999999147 999999169 999999462 999999989 Joost.