From owner-freebsd-stable@FreeBSD.ORG Mon May 9 19:33:18 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F1EC16A4EA; Mon, 9 May 2005 19:33:18 +0000 (GMT) Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEF8D43D54; Mon, 9 May 2005 19:33:17 +0000 (GMT) (envelope-from ewan@mathcode.net) Received: from pimout2-ext.prodigy.net (pimout2-ext.prodigy.net [207.115.63.101])j49JTTDE022027; Mon, 9 May 2005 15:29:29 -0400 X-ORBL: [68.23.218.132] Received: from mail.mathcode.net (adsl-68-23-218-132.dsl.wotnoh.ameritech.net [68.23.218.132])j49JXCmd034336; Mon, 9 May 2005 15:33:16 -0400 Received: from bsd.mathcode.net (localhost [127.0.0.1]) by mail.mathcode.net (8.12.11/8.12.11) with ESMTP id j49JXTYd010615; Mon, 9 May 2005 15:33:29 -0400 (EDT) (envelope-from ewan@bsd.mathcode.net) Received: (from ewan@localhost) by bsd.mathcode.net (8.12.11/8.12.11/Submit) id j49JXSw5010614; Mon, 9 May 2005 15:33:28 -0400 (EDT) (envelope-from ewan) Date: Mon, 9 May 2005 15:33:28 -0400 From: Ewan Todd To: Daniel Eischen Message-ID: <20050509193328.GJ281@mathcode.net> References: <2B4490FF-FEFD-473F-BDF0-293C468A55B9@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on bsd.mathcode.net cc: freebsd-stable@freebsd.org Subject: Re: Performance issue X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 19:33:18 -0000 > > > > 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