You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nicholas Pisarro (JIRA)" <ji...@apache.org> on 2014/01/03 23:45:51 UTC
[jira] [Updated] (THRIFT-2307) Optimization of __eq__ with genslots
[ https://issues.apache.org/jira/browse/THRIFT-2307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nicholas Pisarro updated THRIFT-2307:
-------------------------------------
Attachment: THRIFT-2307-python-slots-faster-eq.patch
> Optimization of __eq__ with genslots
> ------------------------------------
>
> Key: THRIFT-2307
> URL: https://issues.apache.org/jira/browse/THRIFT-2307
> Project: Thrift
> Issue Type: Improvement
> Components: Python - Compiler
> Reporter: Nicholas Pisarro
> Priority: Minor
> Attachments: THRIFT-2307-python-slots-faster-eq.patch
>
>
> With genslots but not gendynamic, the generated __eq__ function iterates over __slots__ to get the attribute names and calls getattr() to get the attribute values of the objects(). However, getattr() is relatively slow.
> Given that we already know all member names at the point of making the generated classes we can generate an __eq__ that looks up all attributes directly and doesn't need to use getattr() or to loop over __slots__
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)