Anyone have an old Pentium II machine?

Geoff Canyon gcanyon at gmail.com
Sat Sep 7 20:43:46 EDT 2013


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



More information about the use-livecode mailing list