0 Favourites

Optimization question

  • I have an optimization question not covered by the usual performance tutorial.

    Does the exporter optimize the math used in event sheets where possible?

    For example, if a value is calculated by adding two constants together, will the exporter recognise that these values can not possibly change after export and add them to avoid the unneeded calculation at run-time?

    I have a very large number of values initialised in this way, and if such an optimization is possible it could have a significant impact on mobile platforms, so if the exporter doesn't already do this I'd like to create my own tool to do so.

  • I don't think the exporter would do this, but that's just my intuition. Who knows what Ashley has cooked up.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • As it so happens, the exporter does implement a "constant folding" optimisation. If you type the expression 100 + 100, at export time C2 can calculate this and determine it's 200, and not export an addition calculation.

    However it's almost completely irrelevant to performance. Don't waste your time worrying about this.

    Anything not in the performance tips manual entry probably has negligable effect. Only things likely to have any effect are mentioned in that article, so if it's not mentioned there, you most likely do not need to worry about it at all. You could optimise all the math across an entire large project, and get maybe a 0.01% performance improvement, if you could even measure that accurately. Compare that to reducing the rate of a particles object which could get you a 1% performance improvement (100x better) at almost no effort at all.

  • Excellent!

    I know it's a fairly insignificant thing, but given the limited capabilities of some of the target platforms I don't think it would have been unreasonable to spend the 10-20 minutes to write myself a quick post-export script which I could then apply to any and every project I ever create. I'm normally all about higher-level algorithmic improvements rather than micro-optimization, but when something can so easily improve every project with very minimal work I feel it's definitely worthy of pursuit. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Even better that the exporter already handles this and I don't need to do the work at all though!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)