Javascript Ember.js 2。使用嵌套模板更消耗内存?
我想知道使用嵌套模板是否会消耗内存 大概是这样的:Javascript Ember.js 2。使用嵌套模板更消耗内存?,javascript,performance,ember.js,ember-data,ember-cli,Javascript,Performance,Ember.js,Ember Data,Ember Cli,我想知道使用嵌套模板是否会消耗内存 大概是这样的: 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',
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'});
});
两个路由映射将消耗大致相同的内存量。你的应用程序中可能有很多其他东西比路由层消耗的内存要多得多。通常,您不应该根据潜在的内存消耗来决定使用哪个路由布局,而应该根据您的UI和URL的外观来决定。两个路由映射将消耗大致相同的内存量。你的应用程序中可能有很多其他东西比路由层消耗的内存要多得多。通常,您不应该根据潜在的内存消耗来决定使用哪个路由布局,而应该根据UI和URL的外观来决定