Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Glenn Linderman
On 5/30/2017 2:18 PM, Guido van Rossum wrote: On Tue, May 30, 2017 at 11:49 AM, David Wilson > wrote: On Tue, May 30, 2017 at 09:38:55PM +0300, Serhiy Storchaka wrote: > > In early ages of C structures didn't create namespaces, and member > > names wer

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Jonathan Cronin
On May 30, 2017, at 11:38 AM, Guido van Rossum wrote:On Mon, May 29, 2017 at 11:16 PM, Serhiy Storchaka wrote:30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just short for "type". T

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Guido van Rossum
But I do stand corrected. I had forgotten that. On May 30, 2017 3:49 PM, "Greg Ewing" wrote: > Serhiy Storchaka wrote: > >> In early ages of C structures didn't create namespaces, and member names >> were globals. >> > > That would certainly explain the origins of it, but I'm > pretty sure it wa

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Greg Ewing
Serhiy Storchaka wrote: In early ages of C structures didn't create namespaces, and member names were globals. That would certainly explain the origins of it, but I'm pretty sure it wasn't the case by the time Python was invented. So Guido must have liked it for other reasons. -- Greg

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Jeff Allen
On 30/05/2017 16:38, Guido van Rossum wrote: On Mon, May 29, 2017 at 11:16 PM, Serhiy Storchaka mailto:storch...@gmail.com>> wrote: 30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just sh

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Guido van Rossum
On Tue, May 30, 2017 at 11:49 AM, David Wilson wrote: > On Tue, May 30, 2017 at 09:38:55PM +0300, Serhiy Storchaka wrote: > > > > In early ages of C structures didn't create namespaces, and member > > > names were globals. > > > >That's nonsense. The reason is greppability. > > > Good reason! > >

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread David Wilson
On Tue, May 30, 2017 at 09:38:55PM +0300, Serhiy Storchaka wrote: > > In early ages of C structures didn't create namespaces, and member > > names were globals. > >That's nonsense. The reason is greppability. > Good reason! The first time I heard about prefixing struct members was to allow tric

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Serhiy Storchaka
30.05.17 18:38, Guido van Rossum пише: On Mon, May 29, 2017 at 11:16 PM, Serhiy Storchaka > wrote: 30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just short fo

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Guido van Rossum
On Mon, May 29, 2017 at 11:16 PM, Serhiy Storchaka wrote: > 30.05.17 09:06, Greg Ewing пише: > >> Steven D'Aprano wrote: >> >>> What does "tp" stand for? Type something, I guess. >>> >> >> I think it's just short for "type". There's an old tradition >> in C of giving member names a short prefix r

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just short for "type". There's an old tradition in C of giving member names a short prefix reminiscent of the type they belong to. Not sure why, maybe someone thought it help

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
29.05.17 17:15, Serhiy Storchaka пише: 29.05.17 15:13, Antoine Pitrou пише: I hope readers won't get bothered by what is mostly a link to blogpost (well, two of them :-)), but I suspect there at least 2 or 3 people who might be interested in the following analysis: https://www.corsix.org/content

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Greg Ewing
Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just short for "type". There's an old tradition in C of giving member names a short prefix reminiscent of the type they belong to. Not sure why, maybe someone thought it helped readability. -- Greg _

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Greg Ewing
David Wilson wrote: They're referred to as slots throughout typeobject.c That's probably where he got the term from. But it really refers to C-level fields in the type object. Magic methods that don't correspond to C-level type fields are not called slots. -- Greg _

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Guido van Rossum
tp_ stands for "type". I wrote all that in 1990 and indeed made up the term slot -- it's like an entry in a C++ vtable, where apparently they are also called slots by some folks. I also did a major update to the machinery here in the early 2000s (when typeobject.c grew from 50 lines to 5000) but

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Steven D'Aprano
On Mon, May 29, 2017 at 07:27:05PM -0700, Guido van Rossum wrote: > > https://www.corsix.org/content/why-are-slots-so-slow > > > > Is the author of that article using non-standard terminology? The article > doesn't appear to be about __slots__ at all. Quoting Armin Ronacher: By far my bigge

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread David Wilson
On Mon, May 29, 2017 at 07:27:05PM -0700, Guido van Rossum wrote: > Is the author of that article using non-standard terminology? The article > doesn't appear to be about __slots__ at all. They're referred to as slots throughout typeobject.c ___ Python-

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Guido van Rossum
On Mon, May 29, 2017 at 7:15 AM, Serhiy Storchaka wrote: > 29.05.17 15:13, Antoine Pitrou пише: > >> I hope readers won't get bothered by what is mostly a link to blogpost >> (well, two of them :-)), but I suspect there at least 2 or 3 people >> who might be interested in the following analysis:

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Terry Reedy
On 5/29/2017 10:36 AM, Guyzmo via Python-Dev wrote: On Mon, May 29, 2017 at 05:15:43PM +0300, Serhiy Storchaka wrote: Interesting articles, thank you. I wonder why the author doesn't propose his patches for CPython. Does he fear that CPython can become faster than Lua? ;-) the author's answer:

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Ben Hoyt
That's very interesting -- thanks for sharing, Serhiy and Antoine. Very relevant! On Mon, May 29, 2017 at 10:15 AM, Serhiy Storchaka wrote: > 29.05.17 15:13, Antoine Pitrou пише: > >> I hope readers won't get bothered by what is mostly a link to blogpost >> (well, two of them :-)), but I suspect

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Guyzmo via Python-Dev
On Mon, May 29, 2017 at 05:15:43PM +0300, Serhiy Storchaka wrote: > Interesting articles, thank you. I wonder why the author doesn't propose his > patches for CPython. Does he fear that CPython can become faster than Lua? > ;-) the author's answer: https://twitter.com/corsix/status/869200284261789

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
29.05.17 15:13, Antoine Pitrou пише: I hope readers won't get bothered by what is mostly a link to blogpost (well, two of them :-)), but I suspect there at least 2 or 3 people who might be interested in the following analysis: https://www.corsix.org/content/compilers-cpython-interpreter-main-loop

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Victor Stinner
Hi, Thank you for the links. -PyObject *value = GETLOCAL(oparg); +PyObject *value = GETLOCAL((unsigned)oparg); Oh, I remember that I proposed to change oparg type to unsigned when Demur wrote the WORDCODE change. I even wrote a patch, but I got a segfault and was unable t

[Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Antoine Pitrou
Hi, I hope readers won't get bothered by what is mostly a link to blogpost (well, two of them :-)), but I suspect there at least 2 or 3 people who might be interested in the following analysis: https://www.corsix.org/content/compilers-cpython-interpreter-main-loop http://www.corsix.org/content/mi