Functions inefficient *

0 favourites
  • What happens if you compile with minify ?

    I ask because according to Ashley the minify/obfuscate option on compile uses Google's Closure Compiler in advanced mode.

    and according to Google info, the advanced mode goes through looking for simple functions and "inlines" them.

    So if the functions as used in events appear as functions in the JS output then maybe these types of simple functions will not even be functions in compiled code.

    "....Compilation with ADVANCED_OPTIMIZATIONS replaces the call to displayNoteTitle() with the single alert() that composes the function's body. This replacement of a function call with the function's body is known as "inlining". If the function were longer or more complicated, inlining it might change the behavior of the code, but the Closure Compiler determines that in this case inlining is safe and saves space. Compilation with ADVANCED_OPTIMIZATIONS also inlines constants and some variables when it determines that it can do so safely...."

    https://developers.google.com/closure/compiler/docs/api-tutorial3

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have worked on procedural generation and implemented the Perlin Noise algorithm in C2 in events and in javascript code

    I found out that javascript is much faster than events, just a fact

  • One possible explanation would be events are not converted to JavaScript, instead they are converted to a bytecode of sorts that is interpreted by the runtime which in turn calls the functions in plugins and the runtime. CC did basically the same thing.

    Now JavaScript engines are really good at analyzing js code and generating fast machine machine code on the fly. That's how js performance can often rival a compiled language. My thought is the events bytecode is basically data and the javascript engine is unable to streamline the data as it does code.

    A fairly complicated solution could be to compile the event sheet to javascrict. Sounds simple but probably is a huge can of worms.

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