Re: Tcl faster than Perl/Python...but only with tricks...




Stephan Kuhagen wrote:

But aside from that, I wondering, if while and gets (or one of them) have
such a big performance impact, and why. Remember, even if I remove the if,
regex and puts in the loop, it just gets twice as fast. I would expect,
that if, regex and puts together should use much more time than while and
gets.

A simple way of removing all the "first time" overheads (interpreter
init, bytecode compilation) would be to do the comparison on a file ten
times larger (just cat it over and over again).

But *if* [gets] is truly slower than it should (I'm not expecting
[while] to be the culprit !), then I'd look around the -translation
(the crlf) and -encoding (unicode conversion) aspects of the channel
(remember there's a mandatory unicode conversion for regexp; I don't
know if this could be a realistic cause for the slowdown though...).

-Alex

.



Relevant Pages

  • Re: regular expression too big
    ... match as a regex. ... why not create a hash out of the data and see if the desired ... regex against each word in the input data. ... puts "Not present." ...
    (comp.lang.ruby)
  • Regular exressions and arguments
    ... very basic program of: ... arg = ARGV ... puts "test isn't working" ... With this code, if i inputs ./filename 'Test', how can i get the regex ...
    (comp.lang.ruby)
  • Re: Extract lines with regular expressions
    ... On 21.04.2008 07:49, Michael Dore wrote: ... I am not too worried about the actual regex - I can figure that out - ... how do I use this in a .rb script? ... puts #what goes here? ...
    (comp.lang.ruby)
  • Re: Regular Expresion Needed
    ... to "translate" a regex in Perl over to Ruby. ... 'abc123def456ghi789jkl'.scan /\d/ do puts $& end ...
    (comp.lang.ruby)
  • Re: Line Before with Sed
    ... 2003/10/29, 07:29, Alan Connor: ... > STILL having trouble with this! ... > SHOULD print the line with the regex and the one before it. ... "sed -n" actually puts this ...
    (comp.unix.shell)