[Python-Dev] Py_SETREF vs. Py_XSETREF

2016-04-03 Thread Serhiy Storchaka
Originally I proposed a pair of macros for safe reference replacing to 
reflects the duality of Py_DECREF/Py_XDECREF. [1], [2]  The one should 
use Py_DECREF and the other should use Py_XDECREF.


But then I got a number of voices for the single name [3], and no one 
voice (except mine) for the pair of names. Thus in final patches the 
single name Py_SETREF that uses Py_XDECREF is used. Due to adding some 
overhead in comparison with using Py_DECREF, this macros is not used in 
critical performance code such as PyDict_SetItem().


Now Raymond says that we should have separate Py_SETREF/Py_XSETREF names 
to avoid any overhead. [4]  And so I'm raising this issue on Python-Dev.


Should we rename Py_SETREF to Py_XSETREF and introduce new Py_SETREF 
that uses Py_DECREF?


[1] http://comments.gmane.org/gmane.comp.python.devel/145346
[2] http://comments.gmane.org/gmane.comp.python.devel/145974
[3] http://bugs.python.org/issue26200#msg259784
[4] http://bugs.python.org/issue26200

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py_SETREF vs. Py_XSETREF

2016-04-03 Thread MRAB

On 2016-04-03 08:32, Serhiy Storchaka wrote:

Originally I proposed a pair of macros for safe reference replacing to
reflects the duality of Py_DECREF/Py_XDECREF. [1], [2]  The one should
use Py_DECREF and the other should use Py_XDECREF.

But then I got a number of voices for the single name [3], and no one
voice (except mine) for the pair of names. Thus in final patches the
single name Py_SETREF that uses Py_XDECREF is used. Due to adding some
overhead in comparison with using Py_DECREF, this macros is not used in
critical performance code such as PyDict_SetItem().

Now Raymond says that we should have separate Py_SETREF/Py_XSETREF names
to avoid any overhead. [4]  And so I'm raising this issue on Python-Dev.

Should we rename Py_SETREF to Py_XSETREF and introduce new Py_SETREF
that uses Py_DECREF?

[1] http://comments.gmane.org/gmane.comp.python.devel/145346
[2] http://comments.gmane.org/gmane.comp.python.devel/145974
[3] http://bugs.python.org/issue26200#msg259784
[4] http://bugs.python.org/issue26200

Checking for NULL is convenient (and safer), but, on the other hand, it 
_would_ be consistent with the others.

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py_SETREF vs. Py_XSETREF

2016-04-03 Thread Armin Rigo
Hi,

On 3 April 2016 at 15:29, MRAB  wrote:
>> Should we rename Py_SETREF to Py_XSETREF and introduce new Py_SETREF
>> that uses Py_DECREF?
>
> Checking for NULL is convenient (and safer), but, on the other hand, it
> _would_ be consistent with the others.

My 2 cents would be to call the new macro Py_XSETREF for consistency,
at least, whether you decide to go with two macros or not.  Otherwise
it's kind of obvious that if you add Py_SETREF that checks for nulls,
in 2 or 3 releases people will really want a "fast" variant anyway,
and there will be no consistent name for that.


A bientôt,

Armin.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] review/proof docs about private memory heap

2016-04-03 Thread J.E. Ogden
After digging through obmalloc.c to optimize some memory intensive code, I
put a paper together on the entire private memory heap that may or may not
be a useful addition to docs.

I was hoping someone could review/proof it for errors in content.

Not sure the policy on links but I've uploaded it to google drive:
https://drive.google.com/open?id=0B6IkX5KnPHVLamwxSTNYR3dJYkE

thanks,
jon
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com