A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044320.html below:

[Python-Dev] Optimization targets - refcount

[Python-Dev] Optimization targets - refcount [Python-Dev] Optimization targets - refcountPaul Prescod paul at prescod.net
Fri Apr 16 02:11:00 EDT 2004
Jewett, Jim J wrote:

> Mike Pall:
> 
> 
>>About GC: yes, refcounting is the silent killer.
>>... Py_DECREF is awful ... > 3500 locations
> 
> 
> Is it always needed?
> 
> What if a few common (constant, singleton) objects 
> (such as None, -1, 0, 1) were declared immortal at 
> compile-time?  They would be created at initial 
> load in a special untracked pool, and their 
> tp_dealloc would do nothing.
> 
> The slot for tracking references would still be
> there, but could be ignored -- even if it went
> negative.
> 
> Since the reference count no longer has to be
> correct (for these objects), the reference 
> counting macros could optimize to nothing when 
> they know at compile time that they'll have one 
> of these constant objects.  

So instead of writing Py_DECREF(foo) would we write code like

if(foo!=Py_None&&foo!=Py_Neg1&&foo!=Py_Zero&&foo!=PyOne){
	Py_DECREF(foo);
}

  Paul Prescod



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4