سؤال

I am using Ember.js to build a website for my company.

The problem I am having is that the initial load time of the page is around 10 seconds.

I cant give you the profiling data from chrome because I can't get them out of work. However what I noticed when looking at them is that there is a function called "Get" which takes in total around 8.5 seconds. I realize this is probably just many uses of Ember.Get(), but still this is just the initial page load.

I don't know if this is normal or not but it's extremely unpleasant. Is there something I can do about this?

Thanks, Jason

هل كانت مفيدة؟

المحلول

try using a production release (the minified version of ember.js), it uses a significantly faster get.

Are you rendering some very large lists? If so look into using List View.

If you have a ton of fields being bound that don't ever change modify them to be unbound.

{{unbound someField}}

If you are having some weird issue where a template is taking a long time, yet you aren't sure which one it is, you can add some timestamp logging to the beginning of your templates to track down the culprit. At the bottom I whipped up a quick helper. In your template you could use it like so. It will print out a timestamp with that data point passed in.

{{logTime this}}
{{logTime name}} 



Ember.Handlebars.helper('logTime', function(someField){
  var d = new Date,
    timestamp = d.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1") + "." + d.getMilliseconds();
  console.log(timestamp + " - " + text);
  return "";
 });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top