Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90633

Re: Building CPython

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; 'python)': 0.05; 'attribute': 0.07; 'debug': 0.07; 'pypy': 0.07; 'lookup': 0.09; 'shame': 0.09; 'slow.': 0.09; 'python': 0.11; 'def': 0.12; 'windows': 0.15; 'bytecode': 0.16; 'complicated,': 0.16; 'creation.': 0.16; 'different,': 0.16; 'discrepancy': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'lookups': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'seconds.': 0.16; 'simpler,': 0.16; 'such,': 0.16; 'ways:': 0.16; 'wrote:': 0.18; '(not': 0.18; 'variable': 0.18; 'seems': 0.21; '(the': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'versions': 0.24; "haven't": 0.24; 'nearly': 0.26; 'header :In-Reply-To:1': 0.27; 'array': 0.29; 'fastest': 0.30; 'mode': 0.30; "i'm": 0.30; 'code': 0.31; 'apparently': 0.31; 'int,': 0.31; 'languages': 0.32; 'quite': 0.32; 'are:': 0.33; 'guess': 0.33; 'test': 0.35; 'but': 0.35; 'version': 0.36; 'explains': 0.36; 'ubuntu': 0.36; 'doing': 0.36; 'method': 0.36; 'seconds': 0.37; 'two': 0.37; 'starting': 0.37; 'mine': 0.38; 'to:addr:python- list': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; 'new': 0.61; 'simple': 0.61; 'first': 0.61; 'making': 0.63; 'within': 0.65; 'between': 0.67; 'obvious': 0.74; '100%': 0.77; '100': 0.79; '*simple*': 0.84; 'timings': 0.84; '9.2': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=DZWZq5dW c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=SY9aFQKHIdAA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=5ANokUeuAAAA:8 a=bUxbpLKClOnPkN3vPEQA:9 a=QEXdDO2ut3YA:10
X-AUTH mrabarnett@:2500
Date Thu, 14 May 2015 23:19:24 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Building CPython
References <7JN4x.37133$Q41.15375@fx25.am4> <mailman.464.1431556504.12865.python-list@python.org> <6w35x.645690$I97.19867@fx31.am4> <874mnfunpn.fsf@elektro.pacujo.net> <zR85x.441429$Zf4.246168@fx22.am4>
In-Reply-To <zR85x.441429$Zf4.246168@fx22.am4>
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.19.1431641969.17265.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431641969 news.xs4all.nl 2961 [2001:888:2000:d::a6]:59641
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90633

Show key headers only | View raw


On 2015-05-14 22:55, BartC wrote:
> On 14/05/2015 17:29, Marko Rauhamaa wrote:
>> BartC <bc@freeuk.com>:
>>
>>> That's a shame because I wanted to tinker with the main dispatcher
>>> loop to try and find out what exactly is making it slow. Nothing that
>>> seems obvious at first sight.
>>
>> My guess is the main culprit is attribute lookup in two ways:
>>
>>   * Each object attribute reference involves a dictionary lookup.
>>
>>   * Each method call involves *two* dictionary lookups plus an object
>>     creation.
>>
>> Tell us what you find out.
>
> I'm just starting but I can tell you that it isn't because debug mode
> (Py_DEBUG defined) was left on by mistake!
>
> What is interesting however is that on the very simple test I'm doing (a
> while loop incrementing a variable up to 100 million), the timings under
> Windows are:
>
> Python 2.5       9.2 seconds
> Python 3.1      13.1
> Python 3.4.3    17.0
> Python 3.4.3    14.3 (under Ubuntu on same machine, using the version
>                        I built today)
>
> That's quite a big range!
>
> PyPy does it in 0.7 seconds. The same program within my own *simple*
> bytecode interpreter (not for Python) has a fastest time of 1.5 seconds
> but makes use of ASM. A version 100% in (gcc) C can manage 2 seconds.
>
> So far I haven't find anything that explains the discrepancy (the
> languages are different, mine is simpler, but the Python code isn't
> doing anything that complicated, only LOAD_FASTs and such, and LOAD_FAST
> is apparently just an array access.
>
> But the nearly 2:1 difference between new and old Python versions is
> also intriguing.
>
> def whiletest():
> 	i=0
> 	while i<=100000000:
> 		i=i+1
>
> whiletest()
>
Python 2.x has int and long; Python 3 has int, which is the old 'long'.
Try Python 2 with longs.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Building CPython BartC <bc@freeuk.com> - 2015-05-13 20:36 +0100
  Re: Building CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-13 20:58 +0100
  Re: Building CPython Terry Reedy <tjreedy@udel.edu> - 2015-05-13 18:34 -0400
    Re: Building CPython BartC <bc@freeuk.com> - 2015-05-14 16:51 +0100
      Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 02:09 +1000
        Re: Building CPython BartC <bc@freeuk.com> - 2015-05-14 18:02 +0100
          Re: Building CPython Dave Angel <davea@davea.name> - 2015-05-14 13:10 -0400
          Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 03:11 +1000
            Re: Building CPython BartC <bc@freeuk.com> - 2015-05-14 18:32 +0100
              Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 03:45 +1000
          Re: Building CPython Terry Reedy <tjreedy@udel.edu> - 2015-05-14 14:50 -0400
            Re: Building CPython Christian Gollwitzer <auriocus@gmx.de> - 2015-05-15 12:51 +0200
              Re: Building CPython Terry Reedy <tjreedy@udel.edu> - 2015-05-15 17:19 -0400
      Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-14 19:29 +0300
        Re: Building CPython BartC <bc@freeuk.com> - 2015-05-14 22:55 +0100
          Re: Building CPython MRAB <python@mrabarnett.plus.com> - 2015-05-14 23:19 +0100
          Re: Building CPython BartC <bc@freeuk.com> - 2015-05-15 01:50 +0100
            Re: Building CPython Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-15 18:05 +1200
              Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-15 11:59 +0300
                Re: Building CPython wxjmfauth@gmail.com - 2015-05-15 02:07 -0700
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-15 12:20 +0300
                Re: Building CPython wxjmfauth@gmail.com - 2015-05-15 02:51 -0700
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-15 13:52 +0300
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 22:10 +1000
                Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 22:34 +1000
                Re: Building CPython wxjmfauth@gmail.com - 2015-05-15 07:11 -0700
                Re: Building CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-15 13:41 +0100
                Re: Building CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-15 13:38 +0100
                Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 19:43 +1000
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-15 13:50 +0300
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 22:43 +1000
                Re: Building CPython Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-15 09:00 -0600
                Re: Building CPython Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-15 09:04 -0600
                Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-16 01:06 +1000
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 20:14 +1000
                Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-15 20:25 +1000
                Re: Building CPython Terry Reedy <tjreedy@udel.edu> - 2015-05-15 17:05 -0400
                Re: Building CPython BartC <bc@freeuk.com> - 2015-05-15 22:54 +0100
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-16 01:44 +0300
                Re: Building CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-16 00:27 +0100
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-16 11:55 +1000
                Re: Building CPython Chris Angelico <rosuav@gmail.com> - 2015-05-16 12:15 +1000
                Re: Building CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-16 03:17 +0100
                Re: Building CPython BartC <bc@freeuk.com> - 2015-05-16 01:43 +0100
                Re: Building CPython MRAB <python@mrabarnett.plus.com> - 2015-05-16 02:16 +0100
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-16 11:08 +0300
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-16 19:40 +1000
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-16 16:59 +0300
                Re: Building CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-17 04:18 +1000
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-16 21:55 +0300
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-17 01:51 +0300
                Re: Building CPython Marko Rauhamaa <marko@pacujo.net> - 2015-05-17 23:49 +0300
                Re: Building CPython Terry Reedy <tjreedy@udel.edu> - 2015-05-15 19:54 -0400
              Re: Building CPython BartC <bc@freeuk.com> - 2015-05-15 10:32 +0100
                Re: Building CPython Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-16 12:55 +1200
                Re: Building CPython Jonas Wielicki <jonas@wielicki.name> - 2015-05-17 14:25 +0200
                Re: Building CPython BartC <bc@freeuk.com> - 2015-05-17 14:41 +0100

csiph-web