On Aug 16, 2012, at 9:32 AM, Fernando Olivero <fernando.olivero@usi.ch> wrote:
I've been using RB, which allows to recreate on demand the ast, but in my system i cached those values.
ast := RBParser parseMethod: 'parsingAMethod | yeah | yeah := self doesAMethodNode remember its source. yeah ifTrue:[ ^ #hurray]'.
ast source. ast formattedCode.
ast := (Object>>#at:) parseTree. ast source. ast formattedCode
Regarding the memory usage, in my system only the methods which have a "method shape" opened in the IDE, store their ast, thus i cannot provide numbers of the overhead. But why should one extra object more per method be a problem?
It's not one object... it's a tree. I did once a system that stored the AST for each method (uncompressed) in addition to what is there now (CompiledMethod). The system was 120MB instead of 20MB. (based on Squeak 3.9) Which means, even then smaller than Eclipse ;-) Marcus -- Marcus Denker -- http://marcusdenker.de