如何减少在Gwt多入口点项目应用程序中的初始加载时间 [英] How to decrease initial load time in Gwt multiple entry point project app

查看:125
本文介绍了如何减少在Gwt多入口点项目应用程序中的初始加载时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java和Google Web Toolkit。问题是当客户端使用我们的应用程序时,大约下载了1.1 Mb并且最初加载时间太长。



有谁知道我们如何减少初始负载在我们的Gwt多入口点项目应用程序中的时间?

官方文档提出了一些要点


  1. 启用压缩功能

  2. 删除未使用的CSS

  3. 缩小JavaScript
  4. 缩小CSS

  5. 缩小HTML

  6. 延迟加载JavaScript

  7. 优化图片
  8. li>
  9. 从一致的网址提供资源。

除此之外,下一步我们可以看一下到代码拆分



尽可能减少 onModuleLoad()中的加载,这对于将应用程序带到客户端的速度要快很多。



编译时间报告可以帮助您大幅度挖掘Object的过度使用情况。 p>

最重要的是,您可以为您的服务器启用gzip ,它将gzip格式的数据压缩为客户端

使用 ArrayLists 代替 列表 HashMap的而不是 Map的,那么GWT编译器会不需要编译 List ,Map等所有可能实现的代码。使用 StringBuilder的而不是字符串。 ..e tc

以及其他一些技巧 Ray Rayan的Google I / O演示文稿


I am using java with Google Web Toolkit. The problem is when a client uses our app, about 1.1 Mb is downloaded and it takes too much time to load initially.

Does anyone know how we can decrease the initial load time in our Gwt multiple entry point project app?

解决方案

The official Docs came up with some bullet points

  1. Enable compression
  2. Remove unused CSS
  3. Minify JavaScript
  4. Minify CSS
  5. Minify HTML
  6. Defer loading of JavaScript
  7. Optimize images
  8. Serve scaled images
  9. Serve resources from a consistent URL.

Apart from that the , next immediate step we can look into Code Splitting..

As much as you can reduce the load in onModuleLoad(),That's greatly helps you to bring the app to client much faster.

And also Compile Time Reports helps you greatly where you are digging too much into Object.

On top of these,You are able to enable the gzip for your server,Which compresses the data in gzip format to client.

More over the standard java coding techniques(respective to GWT) while coding.

Use an ArrayLists instead of Lists, HashMap's instead of Map's then GWT compiler does not need to compile the code for all possible implementations of the List,Map's etc.

Use StringBuilder's instead of String's. ..etc

And some more techniques here Google I/O presentation by Ray Rayan.

这篇关于如何减少在Gwt多入口点项目应用程序中的初始加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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