[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code performance vs Dynamic groovy #31

Open
gdaniel opened this issue May 3, 2017 · 1 comment
Open

Generated code performance vs Dynamic groovy #31

gdaniel opened this issue May 3, 2017 · 1 comment

Comments

@gdaniel
Copy link
Contributor
gdaniel commented May 3, 2017

Is it interesting to generate native code that is more complex but faster than dynamic Groovy implementation?

For example: collect(ref)->isEmpty is translated into getRef(ref).asList().isEmpty(). This implementation is not efficient: getRef returns an Iterable that is filled from the database. If we put it in a list we force the database to load everything just to check if there is at least one element in the list.

Another approach is to dynamically add Iterable.metaClass.isEmpty to the init Groovy script, with an optimized implementation: !this.hasNext(). But Groovy dynamic dispatch is very slow, especially for closure-based methods.

For now I use the first solution, but I don't think it is the most interesting in the general case, need to to some experiments.

@gdaniel gdaniel self-assigned this May 3, 2017
@gdaniel
Copy link
Contributor Author
gdaniel commented Aug 21, 2017

refs #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant