Backbone.js的性能问题。太多的看法? [英] Backbone.js Performance problems. Too many Views?

查看:111
本文介绍了Backbone.js的性能问题。太多的看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建使用Backbone.js的日历应用程序。当我看到使用Chrome浏览器,它的表现还算可以,但有点slugish,但在iPad上也就是目标设备,性能很烂。

I created a calendar application using backbone.js. When I look at it using the Chrome browser the performance is ok but a little slugish but on the iPad which is the target device, the performance sucks.

我不知道如果我创建了太多的意见。

I wonder if I have created too many views.

我创建一个月视图,示出了周的天,一天中的使用为每个对象Backbone.View小时。单击时hourview绑定到click事件,并重新渲染。
但鉴于计算这一切意味着,1个月视图+ 35日视图+ 35 *16小时意见= 596的看法。
是不是太多了?

I created a month view, showing the days of the Week, and the hours of the day using a Backbone.View for each object. The hourview is bound to the click event and rerenders when clicked. But in view counts it all adds up, 1 month view + 35 day views + 35 * 16 hour views = 596 views. Is that too many?

hour = Backbone.Model.extend({});
hours = Backbone.Collection.extend({});
hourView = Backbone.View.extend({});

day= Backbone.Model.extend({});
days= Backbone.Collection.extend({});
dayView = Backbone.View.extend({});

month = Backbone.Model.extend({});
monthView = Backbone.View.extend({});

这是我第一次这么Backbone.js的任何指导,将是有益的。

This is my first time with backbone.js so any guidance would be helpful.

推荐答案

疑难根据您提供什么可讲。
一般而言,多个对象,所述多个存储器的少速度。不同的视觉效果不能用本机过渡/变换(CSS3)时,在iOS设备上会很慢也。

Difficult to tell based on what you provided. Generally speaking, the more object, the more memory the less speed. Different visual effects can be slow on iOS devices also when not using the native transition/transforms (CSS3).

我不会有日历的每一部分不同的看法。这是矫枉过正。我沃尔德创建一个单一的日历视图,并将它刷新其部分是必要的。

I would not have different views for each part of the calendar. That's overkill. I wold create a single calendar view and have it refresh its parts as necessary.

这篇关于Backbone.js的性能问题。太多的看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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