Hi folks, Donald Raab of Eclipse Collections fame, did a recent blog post about what that library has done for better performance:
https://donraab.medium.com/fat-free-lambdas-in-java-bf228da0613b Donald sent me a private message asking about Groovy's take on some of those optimisations, so I thought it might be interesting to analyse things. Past optimisation work, and the recent work Daniel did on optimizing non-capturing lambdas put Groovy on a good footing for some metrics but for many of our DGM methods that take Closures, we have ways (with varying degrees of impact) to make things more performant. I did a benchmark and the results are in: https://issues.apache.org/jira/browse/GROOVY-12034 There is a PR but currently the PR is just the benchmark tests themselves, not any code changes at present: https://github.com/apache/groovy/pull/2557 I'd encourage folks to read that ticket, we have a few options we might want to explore. TL;DR * there are a few potential optimsations we might be able to apply for existing code * we might want to consider a curryWith method, kind of a lazy rcurry * we might want to consider the equivalent of Eclipse Collections "*With" method variants. Instead of "words.findAll{ it.startsWith('A') }" we'd have a variant "words.findAll(String::startsWith, 'A') Anyway, I'll ponder things a bit more and make some follow-up PRs/emails. The analysis suggests just creating the extra variants on a handful of the most widely used DGM methods. But feedback is most welcome. Cheers, Paul.
