grails 2 / groovy 2 / JDK7:如何获得好处? [英] grails 2 / groovy 2 / JDK7: how to reap the benefits?

查看:169
本文介绍了grails 2 / groovy 2 / JDK7:如何获得好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢Grails,但我想知道如何获得Groovy 2的性能优势。
问题是如何配置开发和生产环境,以便接近Java性能提升。 / p>

因此,如果我设置:

  * JDK 7 
* Groovy 2(独立JAR使用invokedynamic)
* Grails 2.2

有没有准则,以真正加速我的webapp 开箱即用



我是否需要对我的任何重新分解Grails的webapp代码库?我的意思是依赖注入的东西,如控制器中引用服务的应该静态编译,或者我应该继续编写代码,如文档说的那样?



ps:我想 Groovy @CompileStatic和Grails 可能是一个相关的问题...

解决方案

它取决于什么可能会减慢你的web应用程序的速度:)我知道取决于通常是答案,但它仍然是正确的。



无论如何,我已经问过,似乎Grails和invokedynamic不会一起合作。重载代理需要更新,并且Hibernate使用的cglib / asm库可能存在问题。



无论如何,内部Grails越来越多地使用@CompileStatic(for这些东西还没有用Java编写),所以除非你的应用程序本身做了很多工作,否则用invokedynamic不太可能会看到很大的提升。



有一些关于这方面的官方信息会很有用,但现在还没有。


I really love Grails but I was wondering how to get the performance benefits of Groovy 2. The question is how to configure the development and production environments in order to get that "close to Java" performance boost.

So, if I setup:

* JDK 7
* Groovy 2 (indie JAR to use invokedynamic)
* Grails 2.2

are there any guidelines in order to really speed my webapp out-of-the-box?

And do I need to do any re-factoring in my Grails webapp codebase? I mean that dependency injection stuff like referencing services in controllers should be statically compiled or should I keep writing code as the docs say?

ps: I guess Groovy @CompileStatic and Grails might be a relevant question...

解决方案

It depends on what might be slowing your web application down :) I know "it depends" is so often the answer, but it's still true.

Anyway, I've asked around and it seems that Grails and invokedynamic won't go together just yet. The reloading agent needs updating and there may be problems with the cglib/asm libraries used by Hibernate.

Regardless, internally Grails is making more and more use of @CompileStatic (for the stuff that wasn't already written in Java), so unless your app is doing a lot of work itself, you're unlikely to see a big boost with invokedynamic.

It would be useful to have some official information on this, but it's not out there right now.

这篇关于grails 2 / groovy 2 / JDK7:如何获得好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆