Ember.js 2.使用嵌套模板更耗费RAM吗?

时间:2017-06-27 09:02:27

标签: javascript performance ember.js ember-data ember-cli

我想知道是否使用嵌套模板非常 RAM耗费 ......

这样的事情:

Router.map(function() {
  this.route('index', {path: '/'});
  this.route('login');
  this.route('authors', {path: 'authors'}, function() {
    this.route('author', {path: ':author_id'}, function() {
      this.route('book', {path: ':book_id'}, function() {
        this.route('cart', {path: 'cart'});
      });
    });
  });
});

更重RAM 比这个?

Router.map(function() {
  this.route('index', {path: '/'});
  this.route('login');
  this.route('authors', {path: '/authors'});
  this.route('author', {path: '/author/:author_id'});
  this.route('book', {path: '/book/:book_id'});
  this.route('cart', {path: '/cart/:cart_id'});
});

1 个答案:

答案 0 :(得分:0)

两个路由映射都将消耗大致相同的内存量。您的应用程序中可能还有很多其他内容消耗的内存比路由层多得多。您通常不应根据潜在的内存消耗决定使用哪种路由布局,而是根据UI和URL的外观来决定。