Archived

This topic is now archived and is closed to further replies.

deadalive

Scripting and Performance

Recommended Posts

I''m exploring scripting languages, specifically LUA and Python. I ''ve got them working and they seem really decent. But I''m wondering if there are performance issues/hits to consider when creating my engine. How much code can one consider reasonable to bind into these languages? Would it be inefficiant to have opengl or d3d bindings and write some of the engine in python?

Share this post


Link to post
Share on other sites
Scripting is SLOW in compared to compiled code, obviously. You don''t want to control the drawing of on-screen objects in a script, for instance. It should be fast enough for logic, though. Also remember that languages like Lua have built-in (though controllable) garbage-collection so if you are creating objects in a script that runs every loop then you might have issues with that...a scripting language, though can add a whole lot of functionality and is worth the trouble, I think.

Share this post


Link to post
Share on other sites
There are some libraries to write machine code on flipcode. You could make your own scripting language compile directly to machine code and it would probably be a lot faster than Lua or Python =-)

Share this post


Link to post
Share on other sites
Yeah, Extrarius is right ... although I must say that this is WAYS too much work to do ;-) ... I have developed several script compilers/interpreters on my own, and a virtual machine as implementation turned out to be efficient enough to handle even some time-critical parts with scripts, but still it is not as fast as it could be ... I thought that over a while ago, and I came to the conclusion that it was practically not worth the effort, because my code would have executed only 2-3 times faster ( estimated value! ;-) )
Anyways, using scripts is IMHO a good way to make your program more "open-hearted", as thehurricane suggested ... it is DEFINITELY worth the effort !!!


Indeterminatus

--si tacuisses, philosophus mansisses--

Share this post


Link to post
Share on other sites