Re: wrappers push/pull stats
Magnus Lie Hetland <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
Samuele Pedroni <[email protected]>: > > Maybe Frame.contents should be made (if possible) a plain attribute like > proxy.wrapper. Perhaps; the idea was that the contents state variable controlled the contents (through push/pull), so that Frame.contents = [btn1, btn2] would actually change the contents. However, this sort of thing is semi-evil since it circumvents the layout mechanism, so it might be better to handle this some other way (e.g. making Frame.contents a read-only translated-to-tuple alias for Frame._contents or something like that). > Apart from profiling things (which is not what this patch do), I > would say just from looking at the code that memoizing the > wrapper.getSetters and wrapper.getGetters results could improve > things. Indeed. I didn't think about optimisation at all when I wrote this. I guess these functions could even be methods in a mix-in (perhaps natural if the memoizing-map is put in an object attribute...). > Apart from obviously reducing if possible the pull/push numbers. That would be good, of course... push can be reduced in at least one way -- checking whether the new value is different from the old one (in self.state). As for pull, I don't see how we can reduce that (except for any erroneously redundant calls, of course; I'm sure there are some... Every time I put some print statement into something like this while debugging, it seems that widgets are created more than once, attributes are set more than once, etc. Still some cleaning up to do.) > Anyway considering that (Am I correct ?) the code tries to be > direct/natural vs avoiding avoidable push/pull calls, the numbers > seem already quite OK. Yeah, if we could make push/pull more efficient that would be just as good, I guess... And, as you say, getSetters and getGetters are potentially a performance sink here. -- Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.org ------------------------------------------------------- In remembrance www.osdn.com/911/