From: Wybo Dekker Date: 2005-07-17T19:33:53+09:00 Subject: Re: [QUIZ] Sampling (#39) My final: < 27s, 7 lines, filesize average approaches 49_444_444 $ time ruby sample1 5_000_000 1_000_000_000 >t; wc -l sample1; wc -c t elap 26.503 user 25.930 syst 0.542 CPU 99.88% 7 sample1 49444971 t Or, chaining some operations: < 28s, 3 lines: $ time ruby sample2 5_000_000 1_000_000_000 >t; wc -l sample2; wc -c t elap 27.780 user 27.181 syst 0.592 CPU 99.97% 3 sample2 49445003 t $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Pentium(R) 4 CPU 2.40GHz stepping : 9 cpu MHz : 2395.242 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr bogomips : 4734.97 -- Wybo