Scripting Languages

Talk among developers, and propose and discuss general development planning/tackling/etc... feature in this forum.
Post Reply
Shark
Confed Special Operative
Confed Special Operative
Posts: 360
Joined: Tue Mar 02, 2004 9:34 am
Contact:

Scripting Languages

Post by Shark »

I know that VS uses Python. However, I thought I'd read that it doesn't compile to binary, and therefore is rather slow.
How about a language such as Lua? From what I understand, it compiles to C code, and therefore should be quicker.

In the past I've written a pretty-printer for Lua code. I could try and create a tool to translates between Python and Lua.
Paslowo
Mercenary
Mercenary
Posts: 121
Joined: Mon Dec 05, 2005 10:01 am
Contact:

Post by Paslowo »

I don't know how Lua could work as a scripting language for VS but it would be pretty neat.

In a matter of fact, Lua is my favorite scripting language eventhough I don't know how to use it yet.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

there is a compiler for Python and lots of the VS Python is pecompiled for speed.

Enjoy the Choice :)
Wisq
ISO Party Member
ISO Party Member
Posts: 453
Joined: Sat Jul 30, 2005 10:21 am

Post by Wisq »

Well, let's be clear here.

When you compile C, say, you're making machine code. (Same if you compile something down to C and then compile that.) Machine code is way fast. And it's heavily optimised, too, which is why compiling lots of C can take a lot of CPU, and that's why you do it once and then run the result over and over.

When you compile Python, Perl, Java, etc., you're producing bytecode. You still need a virtual machine (compiled machine code) to handle all the instructions (compiled bytecode), so it won't be as fast as pure machine code, but at least you don't need to process the raw source code over and over.

Note that some of these require a compiling step beforehand (e.g. Java), some don't but leave behind the compiled code for next time (e.g. Python), and some just recompile the code to memory every time you launch it (e.g. Perl). The effect is always the same -- you've got a virtual machine running compiled bytecode. (Someday, they may all actually run under the same VM.)

So note that although Python is compiled, it's not going to be as fast as a C-based language. Something like Lua, compiled down to C, could be a fair bit faster (assuming it's producing efficient C code).

That being said, I don't personally have a problem with an interpreted run-time-compiled scripting language like Python, so long as it doesn't become bloated or overworked. When code gets complex and/or is being run so often that it's a significant performance drain, then it's time to either slim things up or port code into the C++ core.

(Also, although I'm not a fan of Python myself, at least it's one of the big names that everyone knows; I'm not sure I can say the same for something like Lua. Of course, some of the best languages out there are also the most esoteric. ;))
darvin
Star Pilot
Star Pilot
Posts: 5
Joined: Thu Mar 03, 2011 12:22 am

Re: Scripting Languages

Post by darvin »

I prefer python for it's readability
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Scripting Languages

Post by pheonixstorm »

and you bring up a 5 year old DEAD thread for what reason? (then again I could ask myself the same question...)
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
Post Reply