gpt4 book ai didi

java - GWT 低性能

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:45:48 26 4
gpt4 key购买 nike

作为介绍:我是 GWT 和编码的新手,所以我的问题可能看起来很基础。

我使用 GWT、Maven、Hibernate、IntelliJ IDEA 制作了网络应用程序。我在自己的 Tomcat 服务器上部署了应用程序(为此我有单独的计算机:HP ProLiant ML310e Gen8 v2 4-Core 3.1GHz 4GB DDR3 + HDD 2x1TB SATA)。

这是一个简单的页面,有 5 个选项卡,它有一个 .png 48 Kb 图像作为标题。最初加载的 View 有:

  • 2 个单词很少的标签,
  • 包含20行的CellTable(内容通过RPC从数据库中获取,从数据库中获取)
  • 4 个按钮(用于表格分页)

这个 View 几乎没有内容,它有以下面板,只是为了我想要的精确布局:

3 个垂直面板、6 个水平面板、1 个树和 1 个网格

问题是:。当我第一次运行 URL 时,加载任何内容需要 1:09 分钟。每次我粘贴 URL 时,大约需要一秒钟来显示应用程序。(页面加载后一切顺利,只需一秒钟即可显示小部件)

我读了这篇文章:http://blog.trifork.com/2007/11/30/optimizing-startup-time-for-gwt-hosted-mode/ ,但服务器在生产模式下运行应用程序(GWT.getScript() 返回 true)。我还浏览了一些关于 stackoverflow 的主题,但我没有看到小型应用程序的“正常”加载时间是多少。

如果需要超过 30 秒的时间来运行任何东西,那么 GWT 对于典型用户来说似乎是 Not Acceptable ,他们可能会认为链接在第一次断开......我不知道它是如何工作的 - GWT 正在重建和重新编译每个新用户请求的页面?

最佳答案

I don't know how it works - is GWT rebuilding and recompiling the page for every new user request?

没有。

GWT 使用缓存。初始加载时间实际上取决于很多因素。

When user/browser requests for the very first time, all the resources related to the page loads. That takes few seconds to load and really depends on your internet speed.

Once the complete page loaded and if you are requesting new page/ reloading the current page, all the resources won't load this time.

Coming to the part that rebuilding and recompiling for each request is wrong. In Gwt there are permutations which are specific to each browser. Every major browser have it's own permutation. If you request from Mozilla for example, permutations related to Mozilla loads. These permutations actually generates at compile time of project which you done in your IDE before deploying the project.

Once the request hit the browser, for very first time these all files related to the specific permutation loads into browser and cached in browser. Form next time on words you won't see any new files loading in to browser (you can see that using your firebug).

使用代码拆分、惰性初始化和数据压缩技术。

Continue reading .....

关于java - GWT 低性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26753180/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com