[
https://issues.apache.org/jira/browse/THRIFT-2307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicholas Pisarro updated THRIFT-2307:
-------------------------------------
Description:
With genslots enabled but not gendynamic, the generated python __eq__ function
iterates over __slots__ to get the attribute names and calls getattr() to get
the attribute values. 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__
was:
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__
> 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 enabled but not gendynamic, the generated python __eq__
> function iterates over __slots__ to get the attribute names and calls
> getattr() to get the attribute values. 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)