Anyone have an old Pentium II machine?
Alex Tweedly
alex at tweedly.net
Sun Sep 8 12:20:20 EDT 2013
I googled it (can't remember exactly what phrase) and found a page which
described the obsolete timibg package, and had a "hpw tp replace it
using the new 'time' package", and copy/pasted the code form that. It
just put the various funciton in-line - so I had to change e.g.
"timing.start()" to simply "start()".
Code below ....
import time
timer = time.time
t0 = t1 = 0
def start():
global t0
t0 = timer()
def finish():
global t1
t1 = timer()
def seconds():
return int(t1 - t0)
def milli():
return int((t1 - t0) * 1000)
def micro():
return int((t1 - t0) * 1000000)
and then left the rest of his code only changed to remove "timing." in
various places.
(Actually, the code I copied was clever about setting "timer" to either
time.time or time.clock depending if you were on Windows - but I knew I
wasn't so I just simplified it. Similarly, I removed the section from
the concatenation program which tried to get the process size, and
substituted a "process_size = 0" for it.)
-- Alex.
On 08/09/2013 14:57, Mark Wieder wrote:
> Alex-
>
> Sunday, September 8, 2013, 6:38:40 AM, you wrote:
>
>> 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).
> Yeah - I'm curious about your rewrite. I tried with the timeit package
> and couldn't come up with a satisfactory refactoring.
>
More information about the use-livecode
mailing list