Matthew Fulmer wrote:
Most of the time recompiling a class is not in the compiler. It is in the three full image scans necessary to swap all object instances. All three are within ClassBuilder >> update:to:
That assumes that the majority of time being spent in class reshapes is spent in these memory scans. This certainly didn't used to be the case - the majority of time when dealing with real class hierarchies like Morphic or MVC was spent recompiling (i.e., parsing). Since the compiler is still the same I'm surprised you see that much of a speedup. Unless SystemEditor doesn't recompile but rather relink (update ivar mapping only without parsing)? This would certainly give it a serious boost.
- allInstances in ClassDescription >> updateInstancesFrom:
- elementsExchangeIdentityWith: in ClassDescription >> updateInstancesFrom:to:isMeta:
- becomeForward: or elementsForwardIdentityTo: in ClassBuilder >> update:to:
ClassBuilder thus does 3n full memory scans (where n is the number of classes to recompile)
Yes. Partly to preserve space (since you only need to deal with all the instance of a single class instead of an entire class hierarchy like Morphic). The other reason is ... ClassBuilder>>update:to: which is one nasty set of constraints that it's hard to believe (and even harder to get right).
SystemEditor does n + 2 full memory scans. It does the allInstances search once per class, then groups all the becomes into two becomes at the end of the commit (which is most of the reason why SystemEditor is truly atomic). I've tried to collapse the n allInstance scans into one, but have been unable so far to do it without crashing the VM. I think one should be able to compile any number of classes with just two memory scans (one to find all instances, one to becomeForward: them)
Holy cow. If that actually works, it's impressive as hell. Given the complexity in ClassBuilder (all of which is the direct result of people actually using it and running into issues) it'll be no small feat to get this right in SystemEditor. I've spent a few years on it ;-)
I'm looking forward to test-drive SystemEditor a little more.
Cheers, - Andreas