Skip to main content
GameDev.net gamedev.net
🔒 Locked

which is faster

Started by Pooya65 Jun 29, 2009 at 1:50 PM 10 replies 1.7k views
Original Post
Pooya65
Pooya65
hi, i am developing my own engine that is named D-Engine, this is a cross platform engine which is support unicode and use opengl,openal,cegui and internal AI my question: fastest scripting language ( lua,c script or phyton)? i want to use scripts in my materials,particle systems and AI? which scripting language is enoght fast?! ( for supporting particle systems)
Halifax2
Halifax2
Quote:
Original post by Pooya65
( for supporting particle systems)

You should be doing that in your native language (for speed) and then export manipulation of the system to the scripting language. Don't implement speed-intensive algorithms in the scripting language.

On subject, I can't comment as to which one is faster.

Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume
swiftcoder
swiftcoder
As Halifax has mentioned, you usually don't want to implement tight loops in a scripting language, because they just aren't going to be as fast as native code.

That rules out particle updates, but scripting is still perfect to set material and particle system parameters. I would recommend you go with whichever is easiest to implement/use (probably lua, out of that list).
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Sneftel
Sneftel
Quote:
Original post by swiftcoder
As Halifax has mentioned, you usually don't want to implement tight loops in a scripting language, because they just aren't going to be as fast as native code.

It doesn't have to be slow.
Halifax2
Halifax2
I never knew that Lua did vector operations. What are the profile timings between that and the native C/C++ approach?
Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume
swiftcoder
swiftcoder
Quote:
Original post by Sneftel
Quote:
Original post by swiftcoder
As Halifax has mentioned, you usually don't want to implement tight loops in a scripting language, because they just aren't going to be as fast as native code.
It doesn't have to be slow.
Fair enough, and I have also managed to reach C-like speeds in Python for floating-point operations in tight loops through ctypes-monkeying. However, I would ague that a std::valarray solution implementing your improved particle update code should beat both of them...
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Sneftel
Sneftel
Quote:
Original post by Halifax2
I never knew that Lua did vector operations.

It doesn't out of the box, but they're mostly-trivial to add.
Halifax2
Halifax2
Ah okay, fair enough.
Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume
swiftcoder
swiftcoder
Quote:
Original post by Sneftel
Quote:
Original post by Halifax2
I never knew that Lua did vector operations.
It doesn't out of the box, but they're mostly-trivial to add.
Actually, I am curious how this type of parallel update affects cache coherency, and subsequently performance? If I have a particle system of 10,000 particles, each 32 bytes in size, then a standard loop update ought to keep the cache fed, while the parallel update with traverse the entire array multiple times.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Sneftel
Sneftel
It would depend on whether your particles were SoA or AoS. For the size of particle systems that one generally sees, I doubt it would make much of a difference either way.
swiftcoder
swiftcoder
Quote:
Original post by Sneftel
It would depend on whether your particles were SoA or AoS. For the size of particle systems that one generally sees, I doubt it would make much of a difference either way.
Ah, good point. I don't tend to ever think about data as SoA (bad habit, I know), but it does make a lot of sense.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Ezbez
Ezbez
Great thread here - I wish all of the threads starting "which is faster" would turn out to be as useful and interesting as this one is.

Also, SoA = Structure of Arrays. Google got too many false positives on that acronym; I had to search GD.net to get relevant results.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.