Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90634
| From | BartC <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.python |
| 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> |
| Message-ID | <xpb5x.597872$X95.548374@fx10.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2015-05-15 01:50 +0100 |
On 14/05/2015 22:55, BartC wrote: > def whiletest(): > i=0 > while i<=100000000: > i=i+1 > > whiletest() > > 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. (Actually my ASM-aided code took 0.5 seconds (some crucial section had been commented out). Faster than PyPy and just using simple brute-force methods.) > 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. It turns out the LOAD_FASTs were the simple byte-codes! I'm just starting to find out just how much of a big complicated mess this project really is. I wouldn't be surprised if there aren't many people who actually understand it all, and that would explain why no-one seems to have had much luck in getting the speed up (if anything, it's getting slower). I still have no idea yet exactly what an object comprises. I know that even an innocuous-looking LOAD_CONST actually loads a tuple from a table (complete with flag testing and bounds checks, although taking those out made no discernible difference). It appears to be those "<=" and "+" operations in the code above where much of the time is spent. When I trace out the execution paths a bit more, I'll have a better picture of how many lines of C code are involved in each iteration. -- Bartc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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