[PEAK] PEAK-Rules indexing performance
Alberto Valverde
alberto at toscat.net
Sat Jan 10 15:25:40 EST 2009
Phillip J. Eby wrote:
> At 09:12 PM 1/9/2009 +0100, Alberto Valverde wrote:
>
>> After some peeking at peak.rules internals, motivated by the meta
>> function recipe you posted some months ago to optimize the "isclass"
>> test, I thought about using them to simplify some rules by "wrapping"
>> several related checks under a function without incurring in
>> performance penalties due to non-statically analyzable predicates.
>
> You can't really do that; meta-functions have to expand back into
> statically-analyzable predicates, and so will these "predicate
> functions". Essentially, both meta-functions are like macros, and
> predicate functions will be like macros that take effect at runtime
> instead of compile time. ;-)
Yeah, I understand that the need to expand to statically analyzable
predicates, I must have expressed myself wrong. What I meant is to wrap
several statically analyzable checks like: "(isclass(obj) and
issubclass(obj, Foo)) or isinstance(obj, Foo)" into something nicer
like: "issubclass_or_instance(obj, Foo)". Mainly to clean up the hairy
code in here [1]. Anyway, I think this could probably be done with a
meta function (right?) but first I need to study the source better...
Thanks,
Alberto
[1] http://python-rum.org/browser/rum/basefactory.py#L131
More information about the PEAK
mailing list