The Macbook is just that much faster ....

He was using an old machine, and a (now) old version of Python (artcile was from 2004).

On My Macbook Pro the Python versions are somewhere in the 3-5 million per second (assuming my re-write of the timing stuff was right - he used system packages that are now obsolete).

-- Alex.


On 08/09/2013 01:43, Geoff Canyon wrote:
I saw this on news.ycombinator.com -- http://www.skymind.com/~ocrow/python_string/ -- 
"Efficient String Concatenation in Python" and thought, LC is good at that...

on my machine, here's the script and results:

on mouseUp
    put the script of me into R
    repeat for each item C in "20000,500000"
       put empty into x
       put the long seconds into T
       repeat with i = 1 to C
          put i after x
       end repeat
       put the long seconds - T into T
       put cr & cr & "1 to" && C && "took" && T && "seconds, averaging" && round(C/T) && 
"per second." after R
    end repeat
    put R
end mouseUp

1 to 20000 took 0.012965 seconds, averaging 1542619 per second.

1 to 500000 took 0.282053 seconds, averaging 1772717 per second.

In the article he says, "I ran these tests using Python 2.2.1 on a 433MHz PII 
Celeron under FreeBSD 4.9." His naive approach, roughly equivalent to what I did 
here, manages less than 4,000 concatenations per second, while his clever fastest method 
manages less than 120,000. I'm curious whether LC is that much more efficient, or if it's 
just that a MacBook is that much faster. Anyone have an equivalent PC to compare on?

Sent from my iPad
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to