[IronPython] Speed test

JoeSox joesox at gmail.com
Thu Apr 20 19:28:27 CEST 2006


Ok, I had enough time to test this in IronPythonConsole.exe....


IronPython 1.0.2280 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import sys,time
>>> sys.path.append('E:\\')
>>> import CNUDB
>>> file = 'E:\\machine_All.txt'
>>> def test(thefile):
...     c = CNUDB.ConceptNetDB()
...     time1=time.time()
...     c.load_predicates_file(thefile)
...     time2=time.time()
...     print "-- test took",str(round(time2-time1,2)),'seconds. --\n'
...
>>> test(file)

-- test took 0.28 seconds. --

>>> test(file)

-- test took 0.09 seconds. --

>>> test(file)

-- test took 0.09 seconds. --

>>> test(file)

-- test took 0.09 seconds. --

>>> test(file)

-- test took 0.09 seconds. --

>>>

sum=.64

This test was run on a different machine then the laptop. Pentium4 3ghz 512 RAM
--
Joseph

On 4/19/06, JoeSox <joesox at gmail.com> wrote:
> On 4/19/06, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> > I've opened a bug in our internal database to track the issue.  I'm not sure when we'll get to looking at it just yet as it may be somewhat of an involved investigation.  But at least we won't forget about it.
> >
> > If you could give us something that was nice and self contained then we might be able to get to it sooner.
> >
>
> Ok great.  I think this will work.  Here are the two files you will need:
> http://joeswammi.com/projects/CNUDB.py
> http://joeswammi.com/projects/machine_All.txt
>
> ====
> CNUDB.py is class ConceptNetDB with a test I added when the module is
> run in Python
> if __name__ == '__main__':
>    c = ConceptNetDB()
>    print '\n***** INITIALIZING ******'
>    print '*************************\n'
>    time1=time.time()
>    c.load_predicates_file('E:\machine_All.txt')
>    time2=time.time()
>    print "-- test took",str(round(time2-time1,2)),'seconds. --\n'
> ====
> ====
> machine_All.txt is a file with 631 predicate lines
> ====
> ====
> Next, here is a click event I executed composed in MS Visual C# 2005
> Express on an Athlon64 2.19ghz 512mb RAM laptop...
>        private void button4_Click(object sender, EventArgs e)
>        {
>            PythonEngine ipEngine1 = new PythonEngine();
>            //IronPython...
>            ipEngine1.Execute("import sys");
>            ipEngine1.Execute("sys.path.append('E:\')");
>            ipEngine1.Execute("import CNUDB");
>            ipEngine1.Execute("db=CNUDB.ConceptNetDB()");
>            DateTime time1 = new DateTime();
>            DateTime time2 = new DateTime();
>            time1 = DateTime.Now;
>            ipEngine1.Execute(@"db.load_predicates_file('E:\machine_All.txt')");
>            time2 = DateTime.Now;
>            MessageBox.Show(Convert.ToString(time2.Subtract(time1)));
>        }
> ====
>
> **** Results from MS Visual C# 2005 Express ****
> ran 5 times = {.250, .078, .093, .109, .078} seconds
> sum = .608
> ****
>
> **** Results from IDLE 1.1.2
> ran 5 times = {.03, .03, .03, .05, .03} seconds
> sum = .008
> ****
>
> **** Results from Wing IDE 2.1
> ran 5 times = {.05, .05, .05, .05, .05} seconds
> sum = .025
> ****
>
> I am not sure how to run it in IronPythonConsole.exe
>
> And a side note, if you can this example creates some interesting
> objects like c.bw_edges and c.fw_edges.  I believe at one time I was
> able to .GetVariable c.fw_edges into a System.Object or maybe I
> couldn't because of how dynamic these objects become. For example, if
> I am interpreting correctly c.bw_edges become dictionaries; the have
> Keys with Lists as values.
> --
> Joseph



More information about the Ironpython-users mailing list