【问题标题】:Ember.js 2. Using nested templates is more RAM consuming?Ember.js 2. 使用嵌套模板更消耗内存?
【发布时间】:2017-06-27 09:02:27
【问题描述】:

我想知道是否使用嵌套模板会非常消耗内存...

类似这样的:

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'});
      });
    });
  });
});

比这更多内存吗?

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'});
});

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多