Thread: [Codenarc-developer] GMetrics ASTUtils needs to change
Brought to you by:
chrismair
From: Hamlet D. <ham...@ca...> - 2011-09-15 07:17:14
|
Hi Chris, One of the bigger bottlenecks in CodeNarc is now the GMetrics#ASTUtil getVariableExpressions class. If you could change it to be implemented *exactly* the same way as CodeNarc, then we would shave about 8-10% off the total times. Here is how the method should be implemented: static List getVariableExpressions(DeclarationExpression declarationExpression) { def leftExpression = declarationExpression.leftExpression // !important: performance enhancement if (leftExpression instanceof ArrayExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof ListExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof TupleExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof VariableExpression) { [leftExpression] } else { leftExpression.properties['expressions'] ?: [leftExpression] } } Basically, the last else block should *never* be called. If we ever find that it is called then we need to add a new if branch to avoid that. Hmmm... perhaps we should add a LOG.warning there? -- Hamlet D'Arcy ham...@ca... |
From: Chris M. <chr...@ea...> - 2011-09-16 00:09:44
|
Hamlet, Sounds good. I will put that at the top of my GMetrics to-do's. Would you want to delay the next CodeNarc release to wait for that? Chris -----Original Message----- From: Hamlet DArcy [mailto:ham...@ca...] Sent: Thursday, September 15, 2011 3:17 AM To: cod...@li... Subject: [Codenarc-developer] GMetrics ASTUtils needs to change Hi Chris, One of the bigger bottlenecks in CodeNarc is now the GMetrics#ASTUtil getVariableExpressions class. If you could change it to be implemented *exactly* the same way as CodeNarc, then we would shave about 8-10% off the total times. Here is how the method should be implemented: static List getVariableExpressions(DeclarationExpression declarationExpression) { def leftExpression = declarationExpression.leftExpression // !important: performance enhancement if (leftExpression instanceof ArrayExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof ListExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof TupleExpression) { leftExpression.expressions ?: [leftExpression] } else if (leftExpression instanceof VariableExpression) { [leftExpression] } else { leftExpression.properties['expressions'] ?: [leftExpression] } } Basically, the last else block should *never* be called. If we ever find that it is called then we need to add a new if branch to avoid that. Hmmm... perhaps we should add a LOG.warning there? -- Hamlet D'Arcy ham...@ca... ---------------------------------------------------------------------------- -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ _______________________________________________ Codenarc-developer mailing list Cod...@li... https://lists.sourceforge.net/lists/listinfo/codenarc-developer |
From: Hamlet D. <ham...@ca...> - 2011-09-16 06:22:26
|
I would delay the next release for the fix to GMetrics. It's another 8-9% performance boost. In my mind, I've been thinking that October would bring the new release. So it shouldn't be hard to push out the release of GMetrics. ----- Original Message ----- > Hamlet, > > Sounds good. I will put that at the top of my GMetrics to-do's. Would > you > want to delay the next CodeNarc release to wait for that? > > Chris > -----Original Message----- > From: Hamlet DArcy [mailto:ham...@ca...] > Sent: Thursday, September 15, 2011 3:17 AM > To: cod...@li... > Subject: [Codenarc-developer] GMetrics ASTUtils needs to change > > Hi Chris, > > One of the bigger bottlenecks in CodeNarc is now the GMetrics#ASTUtil > getVariableExpressions class. If you could change it to be > implemented > *exactly* the same way as CodeNarc, then we would shave about 8-10% > off the > total times. > > Here is how the method should be implemented: > > static List getVariableExpressions(DeclarationExpression > declarationExpression) { > def leftExpression = declarationExpression.leftExpression > > // !important: performance enhancement > if (leftExpression instanceof ArrayExpression) { > leftExpression.expressions ?: [leftExpression] > } else if (leftExpression instanceof ListExpression) { > leftExpression.expressions ?: [leftExpression] > } else if (leftExpression instanceof TupleExpression) { > leftExpression.expressions ?: [leftExpression] > } else if (leftExpression instanceof VariableExpression) { > [leftExpression] > } else { > leftExpression.properties['expressions'] ?: > [leftExpression] > } > } > > > Basically, the last else block should *never* be called. If we ever > find > that it is called then we need to add a new if branch to avoid that. > Hmmm... > perhaps we should add a LOG.warning there? > > -- > Hamlet D'Arcy > ham...@ca... > > > ---------------------------------------------------------------------------- > -- > Doing More with Less: The Next Generation Virtual Desktop What are > the key > obstacles that have prevented many mid-market businesses > from deploying virtual desktops? How do next-generation virtual > desktops > provide companies an easier-to-deploy, easier-to-manage and more > affordable > virtual desktop > model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ > _______________________________________________ > Codenarc-developer mailing list > Cod...@li... > https://lists.sourceforge.net/lists/listinfo/codenarc-developer > > |