Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0780e47

Browse files
committed
On MacOSX, added -prebind option to link phase for executable (and
framework, if applicable). This speeds up startup time by up to 50%.
1 parent 7a503a4 commit 0780e47

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

Makefile.pre.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
107107
PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
108108
PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
109109
PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
110+
# Options to enable prebinding (for fast startup)
111+
OTHER_LIBTOOL_OPT = -prebind -seg1addr 0x10000000
110112

111113
# Environment to run shared python without installed libraries
112114
RUNSHARED= @RUNSHARED@

configure

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.384 .
2+
# From configure.in Revision: 1.385 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.53 for python 2.3.
55
#
@@ -9443,7 +9443,11 @@ then
94439443
# -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
94449444
# not used by the core itself but which needs to be in the core so
94459445
# that dynamically loaded extension modules have access to it.
9446-
LINKFORSHARED="$extra_undefs -framework System"
9446+
# -prebind causes the executable to assume dynamic libraries are at their
9447+
# preferred address, which speeds up startup. We specify it here
9448+
# in stead of in LDFLAGS because it does not seem to work for bundle
9449+
# plugins (as of OSX 10.2).
9450+
LINKFORSHARED="$extra_undefs -framework System -prebind"
94479451
if test "$enable_framework"
94489452
then
94499453
LINKFORSHARED="$LINKFORSHARED -framework Python"

configure.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,11 @@ then
11641164
# -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
11651165
# not used by the core itself but which needs to be in the core so
11661166
# that dynamically loaded extension modules have access to it.
1167-
LINKFORSHARED="$extra_undefs -framework System"
1167+
# -prebind causes the executable to assume dynamic libraries are at their
1168+
# preferred address, which speeds up startup. We specify it here
1169+
# in stead of in LDFLAGS because it does not seem to work for bundle
1170+
# plugins (as of OSX 10.2).
1171+
LINKFORSHARED="$extra_undefs -framework System -prebind"
11681172
if test "$enable_framework"
11691173
then
11701174
LINKFORSHARED="$LINKFORSHARED -framework Python"

0 commit comments

Comments
 (0)