Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 May 2005 15:33:28 -0400
From:      Ewan Todd <ewan@mathcode.net>
To:        Daniel Eischen <deischen@freebsd.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Performance issue
Message-ID:  <20050509193328.GJ281@mathcode.net>
In-Reply-To: <Pine.GSO.4.43.0505091428460.27904-100000@sea.ntplx.net>
References:  <2B4490FF-FEFD-473F-BDF0-293C468A55B9@FreeBSD.org> <Pine.GSO.4.43.0505091428460.27904-100000@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> >
> > I ran ktrace(1) on it, and it appears that python keeps calling
> > sigprocmask() continually:
> >
> >     673 python   0.000007 CALL  sigprocmask(0x3,0,0x811d11c)
> >     673 python   0.000005 RET   sigprocmask 0
> >     673 python   0.000009 CALL  sigprocmask(0x1,0,0x8113d1c)
> >     673 python   0.000005 RET   sigprocmask 0
> > etc..
> >
> > This explains why it's using so much system time. Now the question is
> > why is python doing this?
> 
> I don't know what python's doing, but it might not be calling
> sigprocmask directly.  There are a few libc functions that use
> sigprocmask:
> 
> 	db/btree/
> 	db/hash/
> 	pselect(),
> 	setmode(),
> 	{sig}setjmp(), {sig}longjmp(),
> 	grantpt(),
> 	system()
> 
> to name a few.  Python may also be using other libraries which
> use sigprocmask().
> 

OK, it's a python thing.  Whatever python is doing, perl, ruby and C
are not.

4.10 box

perl: 247.66 real       243.29 user         0.63 sys
ruby: 312.36 real       308.49 user         0.17 sys
C:    2.74 real         2.72 user         0.00 sys
C(n=100million):
      42.87 real        40.80 user         0.36 sys
python: 130.78 real       129.86 user         0.11 sys

5.3 box

perl:  128.73 real       127.13 user         0.25 sys
ruby: 159.72 real       158.19 user         0.21 sys
C:    1.62 real         1.59 user         0.01 sys
C(n=100million):
      28.33 real        27.97 user         0.12 sys
python: 104.52 real        69.36 user        33.89 sys

So I'm getting the 2x performance enhancement I expected from the
processor (except for C) from these other languages.

The heapsort test is from
http://shootout.alioth.debian.org/great/benchmark.php?test=heapsort&lang=all&sort=fullcpu

(along with a score or more other languages), and there are a bunch of
other tests at
http://shootout.alioth.debian.org/great/index.php

I'll notify the python porter unless (s)he knows already.

Thanks to everyone who helped.  It would have taken me ages.  No-one
indicated that this was an inappropriate use of the list, but I
apologise if anyone felt that way.

-e




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050509193328.GJ281>