Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#13335 closed enhancement (fixed)

python25 is compiled without optimization, 2x slower on mac os 10.5, others?

Reported by: bulk@… Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 1.5.2
Keywords: Python python25 Cc:



while installing python2.5 on my system, I happened to notice that I didn't see the usual "-O2" option while gcc was compiling files. THen I had a small benchmark program, and yes, it runs 2x slower than 10.5 /usr/bin/python on Mac OS 10.5.1

DEBUG: Environment: CXXFLAGS='-O2' CPPFLAGS='-I/opt/local/include' CFLAGS='-O2'


gcc -c -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -DDARWIN_UNIX03 -I. -I./Include -I/opt/local/include -DPy_BUILD_CORE -o Parser/parser.o Parser/parser.c (to use one example)

I looked into the portfile

platform darwin 9 {

configure.post_args-append OPT="-DDARWIN_UNIX03"


I think this may be clobbering the CFLAGS def. I added

platform darwin 9 {

configure.post_args-append OPT="-O3 -DDARWIN_UNIX03"


and it compiles correctly (but I need to remove and then install everything). I'm pretty sure there must be a way of reading $CFLAGS from the env, but I don't know enough about TCL (I tried $::env(CFLAGS), nope) or MacPorts to know.

WIth -O3, macports python runs about 10% faster than the Mac 10.5.1 python



Change History (7)

comment:1 Changed 13 years ago by nox@…

Milestone: Port Enhancements
Owner: changed from macports-dev@… to mww@…
Priority: HighNormal
Type: defectenhancement

That's not a defect, that's an enhancement, nothing is broken.

comment:2 Changed 13 years ago by mww@…

Status: newassigned

I have no way to test this (no 10.5 here), but does it compile after changing this line to

configure.cppflags-append -DDARWIN_UNIX03


comment:3 Changed 13 years ago by bulk@…

Hi there, sorry for the delay.

for the last comment, it was suggested to use:

configure.cppflags-append -DDARWIN_UNIX03

that's not quite right (at least for 2.5.1_3 port file) me thinks

Using this:

platform darwin 9 {

configure.cppflags-append -DDARWIN_UNIX03


compiled, and has optimization! (on 10.5 anyways). Doing -DDARWIN_UNIX03 did not work btw.



comment:4 Changed 13 years ago by mww@…

Resolution: fixed
Status: assignedclosed

thanks, I changed the line and incremented the revision;

comment:5 Changed 13 years ago by bulk@…

Resolution: fixed
Status: closedreopened


Damn wiki formating screwed us up.

So it's -D underscrore underscore DARWIN_UNIX03

as in (with proper wiki formating)

configure.cppflags-append -D__DARWIN_UNIX03

looks like we both got hit by this. Right now for 10.5 -DDARWIN_UNIX03 does not compile.

Can you fix this?



comment:6 Changed 13 years ago by mww@…

Keywords: Python python25 added
Resolution: fixed
Status: reopenedclosed

Ugh, indeed - thanks for the hint, I just fixed it.

comment:7 Changed 12 years ago by (none)

Milestone: Port Enhancements

Milestone Port Enhancements deleted

Note: See TracTickets for help on using tickets.