Re: [Sqlalchemy-tickets] [sqlalchemy] #2720: new C extensions for attribute accessing
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-07-31 16:58:46
|
#2720: new C extensions for attribute accessing
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: blue sky
Component: cextensions | Severity: very major - up to 2 days
Resolution: | Keywords:
Progress State: not decided upon |
-----------------------------------+---------------------------------------
Comment (by claudiofreire):
The savings are in the avoidance of creating and initializing python
frames, which is the main source of function call overhead in python. Any
function call in python will initialize a frame, some will also create one
(there's a free list to avoid that), so that's why it cannot be done in
python.
Attribute access in python is very very fast, so the overhead of
initializing a frame for such access is noticeable.
The caching is there only as a tool to prevent calling python code (which,
again, pays the full cost of initializing a frame, no matter how fast that
function is inside).
I could find no way to achieve that in pure python. Usually, I use
operator.attrgetter to create fast attribute-getting functions, but this
descriptor does a little bit more than just accessing the attribute, so
that's not viable here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2720#comment:26>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|