Answer your own performance questions with measurements

4
Official Construct Team Post
Ashley's avatar
Ashley
  • 7 Feb, 2015
  • 334 words
  • ~1-2 mins
  • 3,353 visits
  • 2 favourites

Often on the forums people ask questions along the lines of "Which is faster: option A or option B?"

There is no need to ask this question. You can answer it yourself! Simply measure the performance of option A, measure the performance of option B, then compare the results.

Performance is a surprisingly difficult and sometimes counterintuitive area. The systems at work are complex, and sometimes things which seem like they ought to be slower are faster, and vice versa. Also it often depends on the particular details of your project, and asking for advice is asking for a guess. Measurements are the only authority on performance. And you can make the measurements yourself! The key expressions to watch are fps (the frames per second) and cpuutilisation (the approximate CPU time spent in Javascript in the last second).

Often you will not be able to measure any difference at all. Optimisation is often a waste of time: usually everything will be fast enough anyway and you are wasting time worrying about pointless details, or you are worrying over a 0.1% improvement when something else could bring a 25% improvement. To find the thing that makes the 25% improvement you need to rely on measurements. The built-in profiler is a good place to start.

If you can measure a performance difference, congratulations, you have just answered your question more accurately than anyone else could have!

To save you time, the most common things impacting performance are documented in the Performance Tips manual entry. Generally anything not on that list does not commonly cause a performance problem unless used in extreme or unreasonable ways. The manual entry also has more advice about testing performance with measurements.

So if you're ever wondering what will be faster, you probably don't need to worry, but if you must know then get in to the habit of making measurements. That's the only way to know for sure, and on the forum you'll probably just get a bunch of conflicting guesses.

Subscribe

Get emailed when there are new posts!