Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Performance: global functions vs. object methods.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Tzarls   Members   -  Reputation: 806

Like
0Likes
Like

Posted 08 May 2012 - 02:40 PM

Hi. Is there any overhead when calling C++ member functions, compared to calling C++ global functions (from a script)?

Thanks!

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3196

Like
0Likes
Like

Posted 08 May 2012 - 04:10 PM

I'm not aware of any significant overhead when calling C++ member functions compared to C++ global functions from the scripts.

Of course, even in C++ there is a slight overhead when calling member functions compared to global functions. Especially if the member functions are virtual.


Have you noticed a difference in performance? If you show me the script you feel is slower than it should be I'd gladly take a look at it to see if there are any opportunities for optimizing AngelScript further.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Tzarls   Members   -  Reputation: 806

Like
0Likes
Like

Posted 08 May 2012 - 07:26 PM

Have you noticed a difference in performance?


Not really. It´s just that I have my scripts setup so that the script functions call some object´s method of the same script, which in turn calls a member function in my C++ code, and I was wondering if I could improve performance by using global functions. Time for some testing!

#4 Andreas Jonsson   Moderators   -  Reputation: 3196

Like
0Likes
Like

Posted 09 May 2012 - 08:29 AM

Please let me know the result of the tests. I'm always interested in knowing how AngelScript does in real applications.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#5 Tzarls   Members   -  Reputation: 806

Like
0Likes
Like

Posted 21 May 2012 - 10:56 PM

Just finished some testing - first using some member functions exposed to a script, then using static functions exposed to the same script. At first sight it seems that there´s no significant difference - what´s more, I have the feeling that member functions are a little faster. Have to test further but I wanted to post a quick update.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS