煎茶太慢
我在我的一个 JSP 中引入了 Sencha 网格。本地 sencha 相当快,但在外部服务器上则太慢。 我按照此处的部署说明进行操作
http://docs.sencha。 com/ext-js/4-0/#!/guide/getting_started
使用 ext-debug.js 和我的 app.js。 然后,在我的 JSP 中,我导入了 app-all.js (670KB) 和 ext.js
我在哪里错误的 ? 谢谢
I introduced Sencha grid in one of my JSPs. Locally sencha is quite fast but on an external server it is too slow.
I followed deploy instructions here
http://docs.sencha.com/ext-js/4-0/#!/guide/getting_started
using ext-debug.js and my app.js.
Then, in my JSP, I imported app-all.js (670KB) and ext.js
Where am I wrong ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
app-all.js 大小为 670KB,这是一个非常大的文件。您应该重构、优化和缩小代码,使其变得更小。您甚至可以将每个类或实现分成多个文件并执行动态 js 加载(但这会花费更多时间)。一个好的目标应该像 ext.js 一样小。
此外,如果您有权访问网络服务器(即 Apache/Tomcat),则可以在发送到浏览器之前打开 gz 压缩来压缩文件。还要注意其他网络服务器优化。
(顺便说一句,你的问题听起来更像是网络服务器问题而不是 sencha 相关问题)。
app-all.js is 670KB, which is a very big file. You should refactor, optimize and minify the code so it will be smaller. You could even separate into multiple files per class or implementation and do a dynamic js load (but that would take more time). A good target would be as small as ext.js's.
Also if you have access to your webserver (i.e. Apache/Tomcat), you could turn on gz compression to compress files before sending to browsers. Also look out for other webserver optimizations.
(btw, your question sounds more like a webserver issue rather than a sencha related issue).
缩短应用程序加载时间的另一种方法是确保浏览器缓存 ext.js 和 app-all.js。这样,应用程序第一次加载时会很慢,但接下来的加载会更快。
查看缓存控制、过期和其他 HTTP 缓存控制标头 (这似乎是一个很好的解释)。您的服务器应在发送要缓存的文件时生成此标头。
从时间线来看,真正的问题是与服务器的连接速度缓慢(对于大多数连接而言,10 秒加载 206/665 KB 的速度很慢),因此您应该查看是否有其他服务器问题导致速度缓慢。
Another way to improve the load time of your application is making sure ext.js and app-all.js are cached by the browser. This way the first time your application loads it will be slow, but the following loads will be faster.
Look into the cache-control, expires and other HTTP cache controlling headers (this appears to be a nice explanation). Your server should generate this headers when sending the files you want to be cached.
The real problem, as it appears from the timeline, is the slow connection to the server (10 seconds loading 206/665 KB is slow for most connections), so you should see if there are no other server problems causing the slowness.