From: Gregory Brown Date: 2007-07-11T06:21:47+09:00 Subject: Re: Help: Efficient regular expression On 7/10/07, Kyle Schmitt wrote: > Ooooh fun. > so are you going to announce the winner ;) It's just profiler code, you can run it yourself... But on my machine: pid = string[/ (d+)/, 1] cmd = string[/ (S+)$/, 1] % cumulative self self total time seconds seconds calls ms/call ms/call name 58.26 0.67 0.67 1 670.00 1150.00 Integer#times 41.74 1.15 0.48 20000 0.02 0.02 String#[] 0.00 1.15 0.00 1 0.00 1150.00 #toplevel cols = string.split sec, last = cols.values_at(1, -1) % cumulative self self total time seconds seconds calls ms/call ms/call name 66.67 0.70 0.70 1 700.00 1050.00 Integer#times 18.10 0.89 0.19 10000 0.02 0.02 String#split 15.24 1.05 0.16 10000 0.02 0.02 Array#values_at 0.00 1.05 0.00 1 0.00 1050.00 #toplevel number = string.split[1] program = string.split.last % cumulative self self total time seconds seconds calls ms/call ms/call name 61.70 1.16 1.16 1 1160.00 1880.00 Integer#times 23.94 1.61 0.45 20000 0.02 0.02 String#split 8.51 1.77 0.16 10000 0.02 0.02 Array#last 5.85 1.88 0.11 10000 0.01 0.01 Array#[] 0.00 1.88 0.00 1 0.00 1880.00 #toplevel