Function call speed

0 favourites
  • 7 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • I guess this is a question for the developers, but I was just wondering HOW functions are called internally? Having to use string names to call functions is a little concerning. For example, I would never want to create something like "sign(x)" to get the sign of a number called by looking up a number from a function registered via a dictionary (i.e. key-value look-ups).

  • I put a fair amount of effort in to optimising function calls. A function call results in a single lookup of the function name which returns a list of all the relevant events to trigger. This even excludes triggers for functions with different names so it doesn't need to waste time checking them. So they should be pretty fast.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, thanks for the info. ;) My guess is though that executing "x/abs(x)" is probably faster than creating a "sign(x)" function, correct? ;)

  • Thanks for this information. I was wondering about this for a few days. I was wondering if a String based function was searching through a list of strings and doing a string compare. Thanks :)

  • I'm glad I could aid in someone's enlightenment. ;)

  • See Optimisation: don't waste your time. Usually this type of question is totally irrelevant to the actual performance of the app, so you should just do whichever you find easiest.

  • I'm aware of most of this already, but I don't agree 100%. Would you tell a builder to build a house and worry about the foundation quality later - because you just want to save time and see how it will look sooner? Of course not. ;) A foundation is important, and without a solid base to build from, it can cause a whole lot of trouble and extra work down the road (at least in my experience - time is not saved). Yes, you may save time at first, but then when things get slow, it may be too difficult to make the changes later because care was not taken from the start. I agree that scripting may not add much boost, but I'm referring to anything, including graphics. It all needs to be built with care from the start, and not lazily. ;)

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