Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'represents': 0.05; 'exit': 0.09; 'statements': 0.09; 'python': 0.11; '2.7': 0.14; 'thread': 0.14; 'loops': 0.16; 'subject:recursion': 0.16; 'threads,': 0.16; 'wow,': 0.16; 'xrange': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'print': 0.22; 'subject:problem': 0.24; 'mon,': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'overhead': 0.31; 'probably': 0.32; 'linux': 0.33; 'running': 0.33; 'minimal': 0.33; 'subject:the': 0.34; 'received:209.85': 0.35; 'except': 0.35; 'received:209.85.220': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'done': 0.36; 'received:209': 0.37; 'starting': 0.37; 'being': 0.38; 'expected': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'more': 0.64; '100%': 0.77; '40%': 0.84; '95%': 0.84; 'cpu.': 0.84; 'received:209.85.220.44': 0.84; 'received:mail- pa0-f44.google.com': 0.84; 'usage.': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=iSi8zimAzQJacDHKI7MbfCwJWbViF9OOtvwm+qgK0X8=; b=XG+VxrZIu+6quUXP8KmxDpOW7VlBcECs7frNo/15YjNFQB2PZ//AKDEkBHl1M3XJ0N XHY6PExvuJ/SenbC0txHL0AS5WXk/hvhczd+6c0LJUj+06GBOi6foOFxz9ZWnK3lR5BH sBvDkw2TRoDResZ+x+Esu9K1IvrjFNfmzkR4AX662pSFTBeOJmBkF0w3MpNtkoYgURnn sC9QDqiQPXguBVbAuGcYYjVMMXCs33OCVp4MeR81C6EVkuWIsDfO4KZATawbTPx5qDIz n+THbwyJaGtdbaeazA2MzcvDm5rnxh5ncH8b1elp1Wn732rIatezlrAqtjo/IkVrL0HE Evdg== X-Received: by 10.66.157.229 with SMTP id wp5mr4341246pab.14.1369638306228; Mon, 27 May 2013 00:05:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <55942e65-e4a5-45fc-b2fc-ceb4020959dd@k4g2000vba.googlegroups.com> <074eac8a-1bc4-4fe0-afa9-1f52405f81d5@k3g2000vbn.googlegroups.com> From: Ian Kelly Date: Mon, 27 May 2013 01:04:26 -0600 Subject: Re: Solving the problem of mutual recursion To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369638314 news.xs4all.nl 15957 [2001:888:2000:d::a6]:45354 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46175 On Mon, May 27, 2013 at 12:19 AM, Ian Kelly wrote: > 7) Since the program being tested does basically nothing except start > and exit threads, the extra 40% probably represents the overhead of > all that starting and stopping, which would be done outside the GIL. To test this, I tried running the script in Python 2.7 in Linux with the print statements removed and verified that it was using about 135% of the CPU. However, top also told me that only about 95% of that was user processes; the other 40% was kernel usage. The 40% doesn't seem to be threading overhead though, because I tried adding large xrange loops to slow down the thread creation process and it had no effect on the stats. Then I tried running the same program in Python 3.2, and I got the more expected 100% CPU usage with minimal kernel time. So I'm thinking now that the extra 40% may actually be overhead induced by the GIL. If that's the case then wow, the old GIL really did suck.