🎉 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!

speed

Started by
7 comments, last by Lettique 20 years, 1 month ago
hello everybody, finally I''ve started using AngelCode and I''m quite pleased of it. However there''s another thing I''d like to clarify: how fast AngelCode is? I mean how many times (more or less) is it slower (faster ) than C code, its execution time to be specific, let''s say I have the context ready and just call ->Execute(). Mostly I use calling C-function from real C code (host app), no big expressions etc. Thanks, Ltq
Advertisement
I really can''t say. I''ve never done any tests to compare the speed of AngelScript with C code. A guesstimate is between 20 to a 50 times slower.

Should you do any measurements I would be very interested in knowing the results.

__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game

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

I wouldn't call this a scientific measurement, but I was calling an angelscript function every frame that simply returned a value, and getting ~120fps. The context was already made, and calling the function by name or id didn't seem to make much of a difference (although I would expect this to change if I registered a heap more functions). Calling the function twice yeilded ~60fps, 3x = ~45fps.

Replacing the script call with a compiled function that did exactly the same thing saw about ~1600fps.

I was pushing 3 arguments to the function (they will be used later) and grabbing the returned value. I also had a little bit of rendering and physics code in there, but not enough to have much of an effect.

I'm running on an Athlon 2600+.

EDIT: The post makes sense now.

- Xavier

[edited by - meink on May 10, 2004 8:46:13 PM]
There is quite a bit of overhead when calling a script function, so it is reasonable to think that the difference would be huge in this case. Also you have to be careful when measuring the speed of C++ functions, because they might have been optimized, for example a simple function that only returns a value is usually inlined by the compiler giving a completely different situation.

I'm surprised to see that you get 45 fps just by calling executing 3 scripts per frame. It doesn't seem comparable to what others have experienced. Of course if you are using the debug version, this might be true because it saves some statistics to a file for each execution. Which would make it quite slow.

Some examples:

BeatHarness is a WinAmp plugin that uses AngelScript to do the visualizations. It calls executes a script at least 768 times per frame (once per scanline), with very good frame rates. Sorry, there is still not a public release that you can test.

Xtreeme Forces by Raptor Entertainment is using AngelScript for lots of different tasks, i.e AI, event scripting, GUI, etc. I doubt they would have been able to do that if they were getting 45fps with only 3 scripts executed per frame.

My own texture generator executes millions of byte code instructions per second. Don't remember how many at the moment.

To measure the speed of AngelScript it might be a good idea to do a loop that calculates the sum of all values between 1 and 1000000 (as an example). Perhaps 1000000 isn't enough to measure the speed of C++, if so increase the size. In this case you'll have to remember that the C++ compiler probably unrolls the loop somewhat, probably doing 8 adds per iteration.

__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game

[edited by - WitchLord on May 11, 2004 9:41:36 AM]

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

I''ve made some tests and more or less they gave me the result that AngelScript is about 20 times slower than real C calling. Surely it depends on the script, usage etc. I dont treat this as a precise result. In one month time we''ll move some of our AI and physics to scripts then I will be able to make the tests again in real app situation, not as a synthetic test. So I''ll post my results here.

thanks,
Ltq
Cool, then my guesstimate was pretty accurate after all :D

What game are you working on? Is it publically announced? Are you a professional game developer or an independent game developer?

I'm really interesting in knowing where AngelScript is being used. I understand that you are probably still in the evaluation phase with AngelScript, but if you could tell me what you might be using it for I would be thankful. Perhaps an e-mail if it is not supposed to be told publically. I'm very good at keeping confidentiality.

I saw on your site that you've joined the team of NahKolor. Do they have a website that we can take a look at?

__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game

[edited by - WitchLord on May 11, 2004 6:25:30 PM]

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

Good point, I''m using a debug build. I''ll try it with the release version. I''m glad I was wrong actually, I was hoping to be able to use script calls every frame.

I''m making a game by myself for my own enjoyment. 2D vehicles that kill. Oh yeah I''m trying to make as much of the game logic scripted as possible.

- Xavier
quote: Original post by WitchLord
Some examples:

BeatHarness is a WinAmp plugin that uses AngelScript to do the visualizations. It calls executes a script at least 768 times per frame (once per scanline), with very good frame rates. Sorry, there is still not a public release that you can test.


Sorry, it'll be out Any-Day-Now*

BeatHarness can in 'bad' situations (when mixing 2 effect-scripts using 1 transition-script) call per-vertex-functions 768 times per script per frame,
which would amount to uhm... 3x768 I guess

The function being called does quite a bit more than just return a value,
and then there are still other parts of the scripts thet get called too

Still on my Athlon 2500, my framerate in these cases is mostly >40fps if I remember correctly.

Hey, it's just a matter of tweaking your compiler-options I guess ;-)

Edit:
And ALWAYS test speed in release-mode !
(I've seen AS-versions that opened, wrote and closed a debug-textfile each frame )

---
* 'Any-Day-Now' (c) 2004 by L.e.Denninger




[edited by - LDenninger on May 12, 2004 7:05:11 PM]

[edited by - LDenninger on May 17, 2004 6:54:33 PM]
_-=[ "If there's anything more important than my ego around, I want it caught and shot now." ]=--=[ BeatHarness ]=-=[ Guerrilla Games ]=-=[ KillZone ]=-
Andreas is right here. we do have about a thousand AS function calls per frame and the game is a polycruncher as well. the game runs at about 50 fps now and it isnt very well optimized as yet. we are extremely pleased with angelscript but i am still using 1.6.1 now.

My suggesstion is to use scripting as little as possible in the main loop. our basic usage of the script is for object initialization and AI descisions ,testing ,GUI handling etc. we would eventually move it to C++ code and leave an option for the game modders to override certain functions with AS code. this would help extending the app (as one of the goals for a scripting language).



Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

This topic is closed to new replies.

Advertisement