Initializing Python in Optimized mode from C++

John johnc_tan at hotmail.com
Fri Apr 16 20:28:00 EDT 2004


"Rick Ratzel" <rick.ratzel at magma-da.com> wrote in message
news:4080635b$0$46515$39cecf19 at news.twtelecom.net...
>     set Py_OptimizeFlag to 1 for -O, and 2 for -OO.  Do this prior to
> calling Py_Initialize();
>
>     You can also improve your startup time by setting
> Py_NoSiteFlag = 1...assuming you don't need to load site.py
>
>     for example:
>
> extern int Py_OptimizeFlag;
> extern int Py_NoSiteFlag;
> ...
> if( !Py_IsInitialized() ) {
>     Py_OptimizeFlag = 2;
>     Py_NoSiteFlag = 1;
>     Py_Initialize();
> }

I was viewing this thread from Google groups and didn't see your response
before I replied.  This is exactly what I was looking for...thanks!  Out of
curiosity, what does the -OO flag do on top of the normal optimizations?





More information about the Python-list mailing list