DavlinLotze[/url]":3cx197lq]
[url=http:/civis/viewtopic.php?p=26414851#p26414851:3cx197lq said:
bk0[/url]":3cx197lq]My first impression is that you are overthinking memory management--this is Python, focus on the algorithms and let memory do what it does unless you hit an obvious constraint--but it's hard to tell without a specific example.
Well, if I could ignore it at this phase, I would, but there's two problems:
1) If there's some way I can arrange things at an earlier stage - without the recycling implemented - that would prevent me from having to rewrite a bunch of code and interfaces later, I'd like to know.
1a) (Optimally, I'd like a system where I can just turn the interning on or off, or somewhere in between with just a change of a few variables - that would allow me to compare CPU/memory usage patterns, or tune it according to a particular usage case.)
2) I foresee my program depending on interning for more than just reducing memory footprint. It would allow me to make changes to just one object and have it take effect broadly instead of having to walk/search some huge complex tree and change each matching object.
[url=http:/civis/viewtopic.php?p=26414851#p26414851:3cx197lq said:
bk0[/url]":3cx197lq]Define "semantically equivalent" (preferably with pseudocode).
For any two instances
a and
b of class
C, a == b if and only if a.some_core_attribute == b.some_core_attribute. (And, of course a == b if a is b or if a.some_core_attribute is b.some_core_attribute; these are a quicker check, since some_core_attribute may be complex.)
While, for the bulk of the processing, having one copy each of an instance of C is good enough, I foresee situations where it would be handy to have separate copies of them in different segments of the program - each copy with different extended attributes.