C-extension 2 times slower than exe



Hi,

I have a C++ program that I would like to steer using Python. I made the
wrapper using swig and linked the code (without the main function) into
a shared object. My Python script loads the extension and calls a
function of the C-extension, the rest runs entirely within the
C-extension. For comparison I compiled the code including the main
function with the same compilation options and linked all into an exe.
The main function of the exe calls the same function as my Python script
does. Surprisingly the code in the Python C-extension runs twice as long
as the same code in the exe. Does anyone know what could be the reason
for this behaviour?

Thank you in advance

Rolf
.



Relevant Pages

  • Re: Newbie Question HELP!
    ... >print because this only seems to run in python shell, or is there a way to ... Others have mentioned ways to get an EXE, but I am wondering if you are really ... go back to the "DOS"/console window (or start one and cd to the ... and you'll be able to re-run your script by just typing python myprog.py (or even just myprog.py ...
    (comp.lang.python)
  • Re: Question on running exe file in Python
    ... You can't compile things to executables (i.e. machine code, ... (unless possibly you're using a non-CPython implementation of Python). ...
    (comp.lang.python)
  • Re: C-extension 2 times slower than exe
    ... For the exe the main function is linked against this shared ... For the python stuff I made an interface consiting of only one ... I included some code for timing into the C++-code. ... sys 0m0.192s ...
    (comp.lang.python)
  • Re: Question on running exe file in Python
    ... Trying to create an .exe file of my scripting file I had saved it ... You can't compile things to executables (i.e. machine code, ... (unless possibly you're using a non-CPython implementation of Python). ...
    (comp.lang.python)
  • Re: Problem with smtplib and py2exe
    ... | works properly, and I've created an 'exe' of it, using py2exe. ... None of the users have Python installed on their ... | all of the changes are commented out, the py2exe function works. ... | If I put only the email portions of code in a test program, ...
    (comp.lang.python)