简体   繁体   English

Ember.js在IE 7中呈现缓慢

[英]Ember.js rendering slow in IE 7

We created a web application using EmberJS (version 1.0.0-rc5). 我们使用EmberJS(版本1.0.0-rc5)创建了一个Web应用程序。 We notice great performance in Chrome, unfortunately we have to support Internet Explorer 7 as our main platform. 我们注意到Chrome具有出色的性能,很遗憾,我们必须支持Internet Explorer 7作为我们的主要平台。

We notice that performance on IE7 is terrible. 我们注意到IE7的性能非常糟糕。 After investigating the issue, it boils down to the rendering of the template (although routing is also terribly slow). 在研究了问题之后,归结为模板的呈现(尽管路由也非常慢)。 We have no clue if this is due to a mistake in the way we built our application or if this is a problem with Ember. 我们不知道这是由于构建应用程序的方式错误还是Ember存在问题。

I created a small sample app to reproduce the problem. 我创建了一个小样本应用程序来重现该问题。 You can find it at http://manoswerts.be/playground/ember-performance . 您可以在http://manoswerts.be/playground/ember-performance上找到它。 It renders a tree similar to what we do in our app. 它渲染的树类似于我们在应用程序中所做的。 When running it in Chrome, the result shows instantly. 在Chrome中运行时,结果会立即显示。 In IE7 it takes between 30 seconds up to a minute to render. 在IE7中,渲染大约需要30秒到一分钟。 In IE8 it "only" takes 7 seconds. 在IE8中,“仅”需要7秒钟。

Is anyone familiar with this? 有人熟悉吗? Is there a solution to this problem? 有解决这个问题的方法吗?

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Try adding the following to get some more detail about what is taking so long: 尝试添加以下内容以获取有关花费了这么长时间的更多信息:

Ember.subscribe('render', {
  before: function(name, start, payload){
    return start;
  },
  after: function(name, end, payload, start){
    var duration = Math.round(end - start);
    var template = payload.template || '';
    //console.log(Ember.inspect(payload));
    //var title;
    var view = payload.object.toString();
    console.log('rendered', template, view, 'took', duration, 'ms');
  }
});

This will give you timings for every view that is rendered. 这将为您提供渲染每个视图的时间。 When I run your example in Chrome each of person templates take about 2ms to render. 当我在Chrome中运行您的示例时,每个人模板大约需要2毫秒的渲染时间。 There is also some overhead related to the nested {{each}} helpers and rendering the "virtual" views within those {{each}} blocks. 嵌套{{each}}助手和在这些{{each}}块中渲染“虚拟”视图也有一些开销。 In total the list render time is 104ms. 列表渲染时间总计为104毫秒。 That total time will be the last console.log line written after you hit the Show results button. 总时间将是单击“ Show results按钮后最后写入的console.log行。

So based on what you're saying I would expect that total time to be an order-of-magnitude slower for ie7 and ie8. 因此,基于您的发言,我希望ie7和ie8的总时间要慢一个数量级。 If that's the case, wondering if that is distributed evenly or is there a specific view that renders much more slowly. 如果是这样,想知道它是均匀分布的还是存在一个渲染得慢得多的特定视图。

For both IE7 and IE8 it is take same time for me, around 4-5 seconds. 对于IE7和IE8,这对我来说都是相同的时间,大约4-5秒。

Other ember js sample app 其他ember js示例应用程序

https://github.com/dgeb/ember_data_example https://github.com/dgeb/ember_data_example

not working at all with IE7. 与IE7完全不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM