Performance issue
Ewan Todd
ewan at mathcode.net
Tue May 10 09:14:08 PDT 2005
> >
> >I think I've found the problem: Python uses setjmp/longjmp to protect
> >against SIGFPU every time it does floating point operations. The python
> >script does not actually use threads, and libpthread assumes
> >non-threaded processes are system scope. So, it would end up using the
> >sigprocmask syscall, even though it doesn't really need to.
> >The diff at http://people.freebsd.org/~ssouhlal/testing/
> >thr_sigmask-20050509.diff fixes this, by making sure the process is
> >threaded, before using the syscall.
>
> Note that the setjmp/longjmp code is only active if Python is
> ./configure'd with "-with-fpectl", which has been standard for the
> ports built Python for a long time.
>
> ISTR that this was because FreeBSD didn't mask SIGFPE by default, while
> Linux and many other OSes do. I also seem to recall that this may have
> changed in the evolution of 5.x. If so, perhaps use of this configure
> option in the port needs to be reviewed for 5.x and later.
Well, I don't know what else it breaks, but for this microbenchmark,
compiling python-2.4.1 without "-with-fpectl" works swimmingly well
for me. Not only does it bring the system time way down, but the user
time is down too, to about 5/7 of its previous value:
5.3-RELEASE / without "-with-fpectl"
48.78 real 48.22 user 0.15 sys
23372 maximum resident set size
657 average shared memory size
20817 average unshared data size
128 average unshared stack size
5402 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
4889 involuntary context switches
compared with
5.3-RELEASE / with "-with-fpectl"
106.59 real 67.25 user 38.57 sys
23140 maximum resident set size
660 average shared memory size
20818 average unshared data size
128 average unshared stack size
5402 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
0 voluntary context switches
10678 involuntary context switches
I tentatively second Andrew's proposal that the use of this configure
option in the port needs to be reviewed for 5.x and later, pending
independent confirmation of the efficacy of this fix.
-e
More information about the freebsd-stable
mailing list