[IronPython] Speed test

JoeSox joesox at gmail.com
Sun Apr 16 17:06:53 CEST 2006


Am I doing this speed test correctly using the script and process below?

I have unpp.py on a usb jumpdrive E
-------
#unpp.py
import time

def unpp(pp):
    time1=time.clock()
    toks = pp.strip(' ()\n').split()
    pred = toks[0]
    args = ' '.join(toks[1:])[1:-1].split('" "')
    f,i = map(lambda x:int(x.split('=')[1]),args.pop().split(';')[:2])
    time2=time.clock()
    print pred,args[0],args[1],f,i
    print time1
    print time2
    print "-- unpp took",str(round(time2-time1,6)),'seconds. --\n'
----------

===== I run a test in IDLE
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
IDLE 1.1.2      ==== No Subprocess ====
>>> import sys
>>> sys.path.append('E/')
>>> import unpp
>>> p=unpp
>>> p.unpp('(CapableOf \"red bicycle\" \"pump\" \"f=2;i=1;\")')
CapableOf red bicycle pump 2 1
50.3331431788
50.3331713947
-- unpp took 2.8e-005 seconds. --
===== END of IDLE test 2.8e-005 = 0.000028


====== I run same test in IronPythonConsole
IronPython 1.0.2280 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import sys
>>> sys.path.append('E:/')
>>> import unpp
>>> p=unpp
>>> p.unpp('(CapableOf \"red bicycle\" \"pump\" \"f=2;i=1;\")')
CapableOf red bicycle pump 2 1
63280770878.0
63280770878.0
-- unpp took 0.046867 seconds. --
===== END of IronPythonConsole test

If I am doing this correctly, there seems to be a big process time
difference, does this seem to be correct, or I am missing something or
doing the time() incorrectly?
Thanks!
--
Joseph



More information about the Ironpython-users mailing list