2017-06-27 43 views
1

我如果使用嵌套模板這是非常RAM消耗 ...想知道Ember.js 2.使用嵌套模板會消耗更多內存嗎?

事情是這樣的:

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

兩個路由映射消耗的內存大致相同。你的應用程序中可能還有很多其他的東西比路由層消耗更多的內存。您通常不應根據潛在的內存消耗來決定使用哪種佈線佈局,而應根據您的UI和URL的外觀來決定。