[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: ruby incredibly slow (update 2)
From:       "Bill Kelly" <billk () cts ! com>
Date:       2007-11-18 22:43:46
Message-ID: 036201c82a34$7dda3ea0$6442a8c0 () gonzo
[Download RAW message or body]


From: "Ron Jeffries" <ronjeffries@acm.org>
>
>   this chunk of code takes some 15 seconds, which I
> sort of zeroed in on by successive refinement. I have no idea what it
> even means. If someone would care to translate it, I'd be interested
> and grateful.
> 
>    `#{ruby} -i.bak -pe 'sub(/^[0-9]+$/){$&.to_i * 5}' script_tmp`

Appears to be shelling out to another ruby process which will take
all the lines in a script_tmp file beginning with a number, and
multiply those numbers * 5.  The original file will be renamed
script_tmp.bak and the modifiled file will be saved as script_tmp.

(Unless script_tmp is a directory?  I've only ever done -i with
files.)

Normally a command like that wouldn't take long, unless there's
an awful lot of data to process.


Regards,

Bill



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic