Re: [IronPython] Speed test

2006-04-18 Thread JoeSox
On 4/18/06, Srinivasa Rao <[EMAIL PROTECTED]> wrote:
> I don't know
>
> Thanks & Regards
> Srinivasa Rao.

It actually read "00:04:40.4845"
Sorry, I possibly typed it in a confusing way.

--
Joseph
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Speed test

2006-04-18 Thread Srinivasa Rao
I don't know

Thanks & Regards
Srinivasa Rao. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of JoeSox
Sent: Wednesday, April 19, 2006 12:08 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Speed test


On 4/18/06, JoeSox <[EMAIL PROTECTED]> wrote:
> My C# Method clocks in at 4:40.4845

I suppose I need to clarify that is meant to read 4 minutes 40 seconds

--
Joseph
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


“ This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error, please notify the ISMS team of AHSL 
through [EMAIL PROTECTED]
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Speed test

2006-04-18 Thread JoeSox
On 4/18/06, JoeSox <[EMAIL PROTECTED]> wrote:
> My C# Method clocks in at 4:40.4845

I suppose I need to clarify that is meant to read 4 minutes 40 seconds

--
Joseph
___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Speed test

2006-04-18 Thread JoeSox
Thanks Dino for double-checking me there.

I'm not sure if you, or anyone else, is interested as to why I asked
but I'll surely entertain you and some others for a couple of seconds.
:)

I also get the same results from the unpp test, my last test results were...
1st run: 0.1718750
2 to about 6th run: 0.0
est. 7th run: 0.0156250

Don't get me wrong, I am not complaining.  However, I am trying to
rewrite ConceptNet 2.1 to be used with .Net (just as a learning
experience mostly for myself, some odd reason I find it fun, wheither
I ever get enough time to complete it, is another matter) and
ConceptNet loads, by default, three huge text files of those predicate
sequence lines which is then loaded into a very large semantic
network.

At first I tried loading these predicate lines into a
StringCollection, which works great when using
System.IO.File.ReadAllLines()
but things slow down significantly when I try to enumerate the
StringCollection into a PythonEngine.  So, it looks like staying away
from .Net objects, as much as possible, and actually rewriting the
Python code to blend with IronPython is currently looks like the way I
need to go.

So I was able to speed test the loading of the three predicate files
and ConceptNet's creation of some huge dictionary objects which is
used for its semantic mapping.
Both apps basically load:
(1.4mb) predicates_concise_nonkline.txt: loads 27000 predicates
(10.2mb) predicates_concise_kline.txt: loads 174000 predicates
(19.5mb) predicates_nonconcise_nonkline.txt: loads 348000 predicates

Python clocks in at 52.907753 seconds*

My C# Method clocks in at 4:40.4845

I created a new XmlTextReader to read in the settings file which holds
the 3 predicate file paths. I then set time1
then call:
 ipEngine1.SetVariable("pred_file", predfile);
 ipEngine1.Execute(@"db.load_predicates_file(pred_file)");

After the XmlTextReader is closed I set time2:
time2 = DateTime.Now;
MessageBox.Show(Convert.ToString(time2.Subtract(time1)));

* I added the time lines around the method:
time1=time.clock()
self.load_predicates()
time2=time.clock()
to class ConceptNetDB


So I will keep on tweaking things until I get a better load time for
the predicate files.  I am thinking out loud here but I may need to
pass the loading to the Console and then grab the semantic mapping
dictionaries that way.

Just in case anyone is really bored I uploaded my import file that is
currently my version of ConceptNet's ConceptNetDB.py.

http://www.joeswammi.com/projects/CNUDB.py

in the C# speed test above I call
//IronPython...
ipEngine1.Execute("import sys");
ipEngine1.Execute("sys.path.append('E:\')");
ipEngine1.Execute("import CNUDB");
ipEngine1.Execute("db=CNUDB.ConceptNetDB()");
string predfile = "";
DateTime time1 = new DateTime();
DateTime time2 = new DateTime();

before reading the XML settings file.

--
Joseph

On 4/17/06, Dino Viehland <[EMAIL PROTECTED]> wrote:
> IronPython is slower to get things going the first time (because we end up 
> compiling to IL and then JITing the code); it's after that when we really 
> start to shine.
>
> The first time you run this we will take longer to execute it, but if you do 
> it a second time we'll report zero.  When I run it the first time I get ~.20 
> seconds, the second time I get 0 seconds - which is just below the precision 
> of the clock.
>
>
> Do you want to help develop Dynamic languages on CLR? 
> (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of JoeSox
> Sent: Sunday, April 16, 2006 8:07 AM
> To: Discussion of IronPython
> Subject: [IronPython] Speed test
>
> 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.28
>
>
> == I run same test in IronPythonConsole
> IronPython 1.0.2280 (Beta) on .NET 2.0.50727.42
> Copyright (c) Microsoft Corporation. All rights reserved.
> >>> 

Re: [IronPython] Are two PythonEngine instances connected?

2006-04-18 Thread Dino Viehland








We’ve been discussing this
internally and we believe we actually have the right solution, but it’s
not trivial – so it looks like it’ll happen in beta 7 (there’s
a small chance we may decide not to do it entirely still, but hopefully that
won’t happen).

 

The solution involves saving the system
state in our caller context and flowing it to places that would load additional
modules.  But theres a lot of details that we’ll need to get right
to make it all work, and it may uncover a few bugs in our caller context
implementation as well.  So hopefully you can get along for the next month
or so and we’ll be able to get the work done for 1.0.

 



Do
you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)











From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Kristof Wagemans
Sent: Tuesday, April 18, 2006
11:38 AM
To: 'Discussion
 of IronPython'
Subject: Re: [IronPython] Are two
PythonEngine instances connected?



 

I don’t think that I would really
require multiple engine instances if I could use separated sessions (system
states). I could keep the states around and swap them in and out as required.

 

One possible problem: I create a new
session and run a script in it. This script triggers the execution of another
script. I would then need to unplug the current session, create a new session
and run the script inside it. After the second script finishes I need to put
the original session back and let it finish executing. I can imagine that it
would give problems to swap sessions while one was executing (although it was
temporarily suspended).

 

Using AppDomains or multiple Threads
doesn’t seem like a workable solution. It would get very complex to make
the data the PythonEngine needs to operate on available in the other AppDomain.
As for using threads: multithreading and user interfaces don’t work well
together. (I would have hoped that WPF fixed this problem, but alas…)

 

I don’t really need an immediate
solution for this. I’m just experimenting now. I think that the scenario
that I’ve outlined is an important use for IronPython: to integrate in a
.NET application and extend it with programmable and flexible extra
functionality.

 






___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Are two PythonEngine instances connected?

2006-04-18 Thread Kristof Wagemans








I don’t think that I would really require
multiple engine instances if I could use separated sessions (system states). I
could keep the states around and swap them in and out as required.

 

One possible problem: I create a new
session and run a script in it. This script triggers the execution of another
script. I would then need to unplug the current session, create a new session
and run the script inside it. After the second script finishes I need to put
the original session back and let it finish executing. I can imagine that it
would give problems to swap sessions while one was executing (although it was temporarily
suspended).

 

Using AppDomains or multiple Threads doesn’t
seem like a workable solution. It would get very complex to make the data the
PythonEngine needs to operate on available in the other AppDomain. As for using
threads: multithreading and user interfaces don’t work well together. (I
would have hoped that WPF fixed this problem, but alas…)

 

I don’t really need an immediate
solution for this. I’m just experimenting now. I think that the scenario
that I’ve outlined is an important use for IronPython: to integrate in a
.NET application and extend it with programmable and flexible extra functionality.

 






___
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com