realbasic-nug
[Top] [All Lists]

Re: The perl challenge

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: The perl challenge
From: Tim Jones <tjmac at tolisgroup dot com>
Date: Fri, 8 Dec 2006 10:06:38 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <b02020003-1048-ppc-E4E91D83CF344ECBA9805D03ACABF21C at Infinitum dot local>
On Dec 8, 2006, at 10:00 AM, Jan Erik Moström wrote:

Imagine my surprise when it took RB a minute to do what perl did in
15 seconds. I'm not surprised that perl is faster, only HOW much
faster it is. My argument was going to be, "see, difference wasn't
that much, and RB is much easier to read," but these results make it
no contest.

So my question is: Why is RB so much slower? What is it doing that's
making the difference? And could I do something to close the gap?

I missed the original post so I don't know what the perl script actually did but perl is very very good at string handling and regular expressions. At some time I compared perl with other languages that also used the same regular expression for processing text files and the difference was *huge* ... in fact I'm surprised that the difference isn't bigger (assuming we're talking string processing and regular expressions).

And remember, you can call a perl script from within RB (see the Shell class), but you can't call RB from perl :).

So, create the perl script the work on the text and then call this in RB:

myShell.Mode = 2
myShell.Execute "perl-script.pl file-to-process.txt"
Do
    app.DoEvents(10)
Loop Until Not myShell.IsRunning
// handle the myShell.Errorcode and myShell.Results here

Tim
--
Tim Jones
tjmac at tolisgroup dot com


_______________________________________________
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>


<Prev in Thread] Current Thread [Next in Thread>