Neil Toronto wrote: > Phillip J. Eby wrote: >> That having been said, the idea that the statement 'SomeBaseClass.foo = >> 23' is actually going to walk through cache entries and invoke a >> callback for *every* subclass of SomeBaseClass in the program makes me a >> tiny bit nervous. >> >> On the other hand, I suppose it's also a good argument for not using >> class attributes when you really want a global. :) > > Heh. You never know what those crazy users will need to do. You of all > people should know that. :p > > If it's too slow, an obvious way to speed it up is to not use > update_subclasses and avoid the overhead. Besides avoiding calling a > function by pointer, not doing the shadowing check may also be faster > generally, since, as you say, assigned attributes are most likely 1) not > shadowed (they'll almost never be methods), or 2) in a leaf class. It > may be that Armin's invalidate everything approach would be generally > faster that way because it *can* skip shadowed attributes. To update you > have to check for shadowing. > > I may try it. I couldn't say whether it's worth duplicating the code.
Okay, I tried it. SpecialClassAttribute sees a 3% speedup but NormalClassAttribute sees a 9% slowdown. I haven't got a clue what that asymmetry is all about. At any rate, I'll #ifdef it and post a new patch. It's yet another thing to play with. Neil _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com