Rewrite PickleType and Interval result_processors
(original reporter: ged) In my quest for speed, I saw that the TypeDecorator implementation is sub-optimal, in that it doesn't let the TypeDecorator developer specify several processors depending on some kind of parameter, nor cache some expensive lookups through closures.
Here is a patch which changes that (and makes the code cleaner as well IMO). The speed improvement is very modest (~3% for 10 pickle fields which is already unrealistic) for the built-in types decorators (PickleType and Interval) but could potentially be much more important for user-defined decorators.
Since this is a change of API, I'm hoping for this before 0.6.
Comments (7)
-
repo owner -
Account Deleted (original author: ged) Oh... Well... okay... In that case, would you accept a patch which would provide specific bind_processor and result_processor methods for PickleType and Interval?
-
repo owner sure you can do Pickle and Interval.
-
Account Deleted - assigned issue to
(original author: ged)
-
Account Deleted - changed title to Rewrite PickleType and Interval result_processors
- changed milestone to 0.6.0
(original author: ged)
-
Account Deleted - changed status to resolved
(original author: ged) done in adaecccda17d927462df30f7e6be37a300798013 and b5af1759dfc02c16440e603737f3ac04f347ac65.
-
repo owner - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
TypeDecorator
has theprocess_bind_param
andprocess_result_value
methods specifically because they are easier to use and understand, particularly for less experienced Python programmers. If you want to make aTypeDecorator
that has custom closures, thebind_processor
andresult_processor
methods are there as always, as isimpl
so that you can get to the underlying processor.