On 12/8/06 5:09 PM, Daniel L. Taylor at [EMAIL PROTECTED] wrote:

> * You're reading/writing data repeatedly in small chunks. Horrible use of
> disk I/O. <snip> This is why your second implementation was more than 2x
> faster and
> almost as fast as Perl.

I don't think I'd call a 60% difference "almost as fast."

As for the I/O issue, I agree, but I was trying to mimic the perl code, and
I had to use no special buffering in perl. In fact, I would expect the
TextOutputStream to offer its own buffering to avoid the I/O issues you
mentioned.

> * I'm not sure, but I would bet that ( "case " + line ) and ( "r = """ +
> line + """" + chr( 13 ) ) allocate new strings before writing to disk. (I
> doubt the compiler is optimized to recognize what's happening and call Write
> repeatedly or, better yet, call a version that accepts an array of strings
> to write in order.) You want to minimize memory allocations and copying in
> any high speed data processing. RAM is actually slow from the CPU's
> perspective. This is tough in RB for several reasons.

That occurred to me so I was going to try replacing the string concatenation
with multiple writes to see the effects.

As for the rest of your analysis, I agree about what is going on, but,
again, I was simply mimicking the perl code.

> Those wishing for faster string processing aren't going to get it
> automatically. However, I do wish RB would give us the language structures
> and compiler optimizations so that it's possible to output carefully
> engineered RB code that can hang with C on data processing.

Amen.
__________________________________________________________________________
Kem Tekinay                                                 (212) 201-1465
MacTechnologies Consulting                              Fax (914) 242-7294
http://www.mactechnologies.com                        Pager (917) 491-5546

  To join the MacTechnologies Consulting mailing list, send an e-mail to:
           [EMAIL PROTECTED]






_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to