Vaadin 7 组件延迟加载以提高性能 [英] Vaadin 7 component lazy loading for performance improvement

查看:42
本文介绍了Vaadin 7 组件延迟加载以提高性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Vaadin 7 应用程序中,我的视图很重.服务器端工作得非常快 - 我的 init() 方法中的所有逻辑都需要大约 100-150 毫秒,但在浏览器中呈现需要很多时间(取决于组件的数量).现在,在 Google Chrome 中显示此视图大约需要 10 秒.

我正在寻找一种方法来优化此视图的性能.我找到了

更新

这是一个演示项目 Vaadin 演示项目,可以重现此性能问题.

为了启动这个应用程序,请简单地运行 Maven 命令:

mvn 全新安装

从项目文件夹以编译源代码和 Vaadin 主题.

然后运行 ​​com.techbook.ui.Application 类(该类包含 main 方法),应用程序将在 Embedded Tomcat 8 上启动,然后请访问以下网址:

http://127.0.0.1:8080/vaadin-ui/#!decisions/123/Name

com.techbook.ui.view.decision.DecisionView - 是一个提到性能问题的视图.

解决方案

我建议您为这个重视图"使用自定义布局,可能结合一个简单的 htlm 模板.应用程序变得更快的另一种可能性是替换某些布局组合.例如.使用 GridLayout 代替 VerticalLayout 和 Horizo​​ntalLayout 组合.如果 UI 指南允许,请使用 AutoCompleteTextField 或 SuggestField 插件而不是 NativeSelect 或 ComboBox.

希望我的一些建议可以帮到你,

弗洛里安

In my Vaadin 7 application I have a heavy view. Server side works pretty fast - all logic in my init() method takes ~100-150ms but rendering in the browsers takes a lot of time(depends on number of components). Right now it is ~10sec in order to display this view in Google Chrome.

I'm looking for a way in order to optimize performance of this view. I found LazyLoadWrapper but it looks a little bit outdated.

Is any similar to this component for Vaadin 7.6 in order to improve user experience and performance of view rendering ?

UPDATED

This is a demo project Vaadin Demo Project that can reproduce this performance issue.

In order to start this application please simple run Maven command:

mvn clean install 

from project folder in order to compile the source and Vaadin theme.

and then run com.techbook.ui.Application class (this class contains main method) and the application will be started on Embedded Tomcat 8 and then please access a following url:

http://127.0.0.1:8080/vaadin-ui/#!decisions/123/Name

com.techbook.ui.view.decision.DecisionView - is a view with a mentioned performance issue.

解决方案

I would suggest you to use Custom Layouts for this "heavy view", probably in combination with a simple htlm template. Another possibility that the application becomes faster is to replace certain layout combinations. E.g. Instead of a VerticalLayout and HorizontalLayout combination use a GridLayout. Use the AutoCompleteTextField or SuggestField addon instead of a NativeSelect or ComboBox if the UI guideline allows that.

I hope some of my suggestions may help you,

Florian

这篇关于Vaadin 7 组件延迟加载以提高性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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