Python speed vs csharp

Guenther Starnberger gst at gmx.at
Thu Jul 31 07:34:51 EDT 2003


Mike <mike at nospam.com> wrote in message news:<rkdc7poiachh.1x4jtxjzaf3zo.dlg at 40tude.net>...

> The current execution time is acceptable, but I need to increase the
> complexity of the simulation, and will need to increase the number of data
> points by around 20X, to roughly 30 billion. This will increase the
> simulation time to over a day. Since the test case code was fairly small, I
> translated it to C and ran it. The C code runs in approximately 7.5
> seconds. That's compelling, but C isn't: part of my simulation includes a
> parser to read an input file. I put that together in a few minutes in
> Python, but there are no corresponding string or regex libraries with my C
> compiler, so converting my Python code would take far more time than I'd
> save during the resulting simulations.

just write the time critical code in C and use SWIG
(http://www.swig.org/) to generate a wrapper which allows you to call
your C function from your python code.

/gst




More information about the Python-list mailing list