Rewrite PickleType and Interval result_processors

Issue #1598 resolved
Former user created an issue

(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)

  1. Mike Bayer repo owner

    TypeDecorator has the process_bind_param and process_result_value methods specifically because they are easier to use and understand, particularly for less experienced Python programmers. If you want to make a TypeDecorator that has custom closures, the bind_processor and result_processor methods are there as always, as is impl so that you can get to the underlying processor.

  2. Former user 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?

  3. Log in to comment