MoonScript performance isuess?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

MoonScript performance isuess?

Post by Murii »

Hello community!

For a couple of weeks I took a break from Lua/Love2d untill now, when I saw Moonscript witch seems pretty cool but I have one simple question and that is: If I am going to use MoonScript will I have any performance issues because i saw that MoonScipt compiles to Lua and Lua complies to byte code(if I am not wrong) so this means much more time to complie and maybe this means lag?
What do you think does it wroth to learn it?Or it is a waste of time?


P.S :Before you ask why I want to switch from Lua to MoonScript ,because of classes,operators and things like this I think it looks more like C#,Java and more elegant.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: MoonScript performance isuess?

Post by raidho36 »

There's only one answer to this kind of questions:

MEASURE.

But I'm pretty sure it will get slow if you gonna use it's special features extensively, as they gonna work on top of plain Lua. It's like C++ itself just as fast as plain C, but once you start going hard on classes/templates/whatever it's starting to have performance issues.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: MoonScript performance isuess?

Post by Murii »

I really need a simple hello world example in moonscript because i cant figure out how to compile it :(
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: MoonScript performance isuess?

Post by raidho36 »

Then why would you even want to use it? Is syntactical sugar really means that much for you? I'm a C coder so I don't have a habit to value these kind of things at all.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: MoonScript performance isuess?

Post by jjmafiae »

i think the compile time would be insane.
but im not the best here at things like that so it may not be true.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: MoonScript performance isuess?

Post by Robin »

Of all the pros and cons of MoonScript, compilation time is not an issue you should be concerned with.
Help us help you: attach a .love.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: MoonScript performance isuess?

Post by jjmafiae »

but why not you just a use a library similar to lovelymün or something like that?
Mikaboshi
Prole
Posts: 12
Joined: Mon Jul 22, 2013 8:55 pm

Re: MoonScript performance isuess?

Post by Mikaboshi »

No, performance won't really be an issue with MoonScript unless you force it. Read the documentation, and see what the corresponding Lua code looks like. If you use OO, it will be slower than if you don't. This is the same with Lua if you're using an OO library. If you use a ton of list/table comprehensions instead of in-place operations where possible, it will be slower. Same with Lua if you decide to make new tables instead of in-place operations. However, MoonScript is good at using best practices, like avoiding table.insert and other slow operations, so it may be faster in some situations than hand-written Lua. I'm writing my my 'engine' code in Lua and my game code in MoonScript and have no problems.

To clarify, compilation time is not related to performance. Compilation time isn't a problem with MoonScript, as in the time it takes to turn a .moon file into a .lua file. Performance is what my paragraph above is related to.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: MoonScript performance isuess?

Post by Murii »

Mikaboshi wrote:No, performance won't really be an issue with MoonScript unless you force it. Read the documentation, and see what the corresponding Lua code looks like. If you use OO, it will be slower than if you don't. This is the same with Lua if you're using an OO library. If you use a ton of list/table comprehensions instead of in-place operations where possible, it will be slower. Same with Lua if you decide to make new tables instead of in-place operations. However, MoonScript is good at using best practices, like avoiding table.insert and other slow operations, so it may be faster in some situations than hand-written Lua. I'm writing my my 'engine' code in Lua and my game code in MoonScript and have no problems.

To clarify, compilation time is not related to performance. Compilation time isn't a problem with MoonScript, as in the time it takes to turn a .moon file into a .lua file. Performance is what my paragraph above is related to.
Can you explain me how to compile moon into lua?Perhaps a simple example would be fine!
Mikaboshi
Prole
Posts: 12
Joined: Mon Jul 22, 2013 8:55 pm

Re: MoonScript performance isuess?

Post by Mikaboshi »

Murii wrote:
Mikaboshi wrote:No, performance won't really be an issue with MoonScript unless you force it. Read the documentation, and see what the corresponding Lua code looks like. If you use OO, it will be slower than if you don't. This is the same with Lua if you're using an OO library. If you use a ton of list/table comprehensions instead of in-place operations where possible, it will be slower. Same with Lua if you decide to make new tables instead of in-place operations. However, MoonScript is good at using best practices, like avoiding table.insert and other slow operations, so it may be faster in some situations than hand-written Lua. I'm writing my my 'engine' code in Lua and my game code in MoonScript and have no problems.

To clarify, compilation time is not related to performance. Compilation time isn't a problem with MoonScript, as in the time it takes to turn a .moon file into a .lua file. Performance is what my paragraph above is related to.
Can you explain me how to compile moon into lua?Perhaps a simple example would be fine!
Install MoonScript (http://moonscript.org/) -- See installation section. Make sure moon/moonc are in your PATH so you can use them.

Make a .moon file with the source code in it.

Open up command prompt/terminal, cd to the directory with your .moon file, and type moonc file.moon.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 145 guests