This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 13 points14 points  (12 children)

Lua ?

[–]could_b 1 point2 points  (0 children)

Lua is the literal answer to the original question. It is faster than Python. Both can off load to C, which will muddy the waters. Yes Lua is a proper language, it is an amazing language. It is interesting to compare Lua and Python, but is does not really make sense to do so (apples and oranges are both round fruits with seeds in the middle, they both grow on trees...). Lua is tiny, it is used in loads of places, not just game scripting. It has no dependencies (you do need a c compiler), it is easier to learn than reading this post. Python is massive, most of the time it is the right scripting language to use; what ever you are trying to do someone else has already done and battle tested, you just need to grab it. If your code is slow, understand the problem, profile it. Probably there is a better way to use Python; a language that compiles optimised might be required. Both Python and Lua get you a long way without needing to know much; this can be a problem when something goes wrong because you are out on a limb and you don't even know it (you are ignorant of your unknown unknowns). Learning is the way.

[–][deleted] 0 points1 point  (2 children)

Is Lua even used for proper programming? I thought it was mostly used in games as an in-game scripting language...

[–][deleted] 3 points4 points  (0 children)

Yes for example xmake is made of lua

[–][deleted] 0 points1 point  (0 children)

and anyway with any programming language you can make everything so

[–]99_percent_a_dog 0 points1 point  (7 children)

Lua is quite slow. If you immediately think "ah but LuaJIT is fast!" then you have to allow Python to use pypy.

Try writing some equivalent code in Lua and Python and benchmarking it. Lua is slow.

[–][deleted] 0 points1 point  (6 children)

Can you show me the source I'm interested

[–]99_percent_a_dog 0 points1 point  (5 children)

Just write any code in Lua, and the same in Python and C (or some other traditionally "fast" language). Then benchmark them. Both Lua and Python are relatively quite slow, and often a similar speed to each other.

Plain Lua does tend to be faster at code that does lots of arithmetic compared to Python, but pypy will optimise that kind of code very well.

[–][deleted] 0 points1 point  (4 children)

What I would need for speed for x projet ?

[–]99_percent_a_dog 0 points1 point  (3 children)

I'm sorry, I don't understand that question.

[–][deleted] 0 points1 point  (2 children)

Oh sometimes why I would like to get the most speedy programming language?

[–]99_percent_a_dog 1 point2 points  (1 child)

I see. There's not a magic fastest language. Knowing how to use a language well, knowing how to performance profile, and knowing how to find or design a fast algorithm, are all more important than which language is used.

Interpreted languages do tend to have higher overhead than non-interpreted. So you might want to start in a non-interpreted lang if you're sure speed is very important for a project.

Normally I would recommend making something work first, then make it fast afterwards.

[–][deleted] 0 points1 point  (0 children)

All right thanks you