Language speeds?

Posted by Drauka on Wed 01 Nov 2006 08:49 PM — 5 posts, 22,164 views.

#0
I noticed that some people seem to be stuck on Lua and Python for scripting.

I can understand Lua as it seems to be _the_ scripting langauge of Mushclient, yet is there a speed comparison someplace? Maybe how one would be slower or faster in different situations.


Searching hasn't given me much to work with, so posting here.

Thanks in advance!
Russia #1
Lua is embedded, while all other languages go through ActiveScripting, so where Mushclient callbacks are involved Lua will be faster than any other language. But even with ActiveScripting it's all very different. For example, Python is slower with it than Vbscript.

Other than that - depends on the language and task. This seems to be a popular, though disputed source of cross-language benchmarks: http://shootout.alioth.debian.org/
Australia Forum Administrator #2
Yes indeed, that page shows that Lua stacks up pretty well, against things like Perl, for instance. Interestingly they don't list VBscript, who knows why? Perhaps legal reasons.

Lua is slower than C++, however C++ is of course compiled and not a script language.

My personal tests have shown that Lua is acceptably fast for most applications I have wanted to use it for, even doing things like finding the fastest speedwalk path through Darkhaven, involving thousands of calculations.
#3
Oh ok, that clears up some things. I thought they all had embedded interpreters.

I may have to refresh Lua then, I am currently writing mine in Perl... yet if anything can be prototyping for Lua.

Just was running into issues where it made it clear that I am not sharp as a tack on Lua (like trying to append to a table lookup: foo["bar"] = foo["bar"] .. "monkeys" .. "moo")

One great thing about Lua, all documentation is online and the language isn't complex (like C++, which can be a pain versus the spoiledness of scripting langauges).

note: I code for a living using about 4 different langauges in my day to day work.
Amended on Wed 01 Nov 2006 11:01 PM by Drauka
Australia Forum Administrator #4
Yes, it is a nice language alright.


Quote:

(like trying to append to a table lookup: foo["bar"] = foo["bar"] .. "monkeys" .. "moo")


You can save a bit of typing here:


foo.bar = foo.bar .. "monkeys" .. "moo"


For string subscripts, an alternative syntax is to omit the brackets and quotes, that is equivalent to what you did.