🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Wierd performance issue?

Started by
6 comments, last by WitchLord 18 years, 1 month ago
Hello everyone, I read this benchmark post earlier: http://www.gamedev.net/community/forums/topic.asp?topic_id=394913 And I was really shocked by the results.. I mean, it makes sense if it takes some time to call a script function from C++, but an average of over 9ms/call? That's like 9 times longer than my d3d render code takes.. Any idea of what might have caused this?
Advertisement
1000 microseconds = 1 millisecond. Each call took 9 microseconds, or 0.009 milliseconds. That means you can call 111 functions each millisecond. Or 111111 functions every second.
Ahhh! That explains it.. I was completely sure it said milliseconds.. Thanks alot for pointing that out, it really scared me since I'm planning on depending pretty hard on AS for a project.. Although, any ideas why it's like 30 times slower than Squirrel?
It's not; it's 3 times slower. And go look at the results again. That was just the function call overhead. Almost everything else was significantly faster.
3894*3 = 11682 which is alot less than 90453..? Well, say 25 times then. Yes, I know it's only the calling overhead, and I know everything else (except the int math and array thingy) is faster in AS. I had no intention to complain about AS in the original post or in the last one, and I'm sorry if it seemed so. What I wanted was to alert you about what I thought was a very serious problem (stupid me can't see the differense between micro and milli, especially not at 4am), and to see if you knew of some workaround (like calling by function/method id instead of name)?

To clarify things, I've never used AS, but I have plans to use it quite heavily on my current project, and the examples and documentation have led me to recommend it to alot of people. So again, sorry for this thread, I should have read more closely..
Actually, only one other test was slower, and it had nothing to do with the math - it was because AngelScript's built in arrays are bounds-checked and overall safer than squirells.

The original benchmarker probably has a bug in his output that is cropping the ratio output off at 003.
Quote: Original post by Deyja
Actually, only one other test was slower, and it had nothing to do with the math - it was because AngelScript's built in arrays are bounds-checked and overall safer than squirells.


Are there any plans to try to improve the function call overhead in AS?
I mean for example, is there possibly a way to achieve more competetive function call times by using some sort of cache mechanism for the boundchecking related data?

The Prepare() call is currently extremely heavy, though 9 microseconds is still quite acceptable in most cases.

I do indeed plan on improving that bottleneck, and I have many ideas on how to do that. It believe it should be quite easy to bring it down to about 10% of what it currently is. I may not be able to get it down to the speed of Squirrel (I don't know what's involved in squirrels calls), but it should at least be more comparable.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement