mruby
github.com
github.com
"Lightweight", does that mean:
Small but slow?
Big but fast?
Quite small and quite fast, but with a half-assed library?
Big, slow, but low RAM usage?
I understand from another comment that this is intended for embedded systems. Does that mean running it on a microcontroller without OS? Cause the moment you can flash Linux, you can use Ruby MRI, no?Nope, he said embedding. He means things like Lua where you have a scripting language embedded in a program that is running on a faster lnaguage. Common in video game dev.
>Does that mean running it on a microcontroller without OS?
Nope, not necessarily. It being portable means it's plausible but it's an unlikely usage scenario. More likely, it means being able to use it across a variety of POSIX derivatives.
>Cause the moment you can flash Linux, you can use Ruby MRI, no?
Also not true. What a micro-distribution of Linux can run on is not necessarily something MRI Ruby can also run on.
That said, Lua is fucking weird.
But my first impressions are not very positive (stripped x86_64 executables with -Os):
-rwxr-xr-x 1 user group 708480 Apr 20 11:27 mrbc
-rwxr-xr-x 1 user group 713056 Apr 20 11:27 mruby
-rwxr-xr-x 1 user group 712128 Apr 20 11:27 mrubysample
compared to lua-5.2.0: -rwxr-xr-x 1 user group 147864 Apr 20 11:28 lua
-rwxr-xr-x 1 user group 99168 Apr 20 11:28 luac
I'm not a big fan of lua as a language but it has been the only option to do scripting on small embedded systems. I've manged to compile size-optimized version of lua on arm to the size of about 80kb but mruby just might be too big for my embedded usage. - comments start with --
- no bitwise operations in language
- default numeric data type is floating-point. it's possible to change it to
integer but it raises uncertainty with compatibility of external libraries
- OOP in lua is quite programmer-specific: everyone seems to have their own
best practises
Of course lua has good features too, like coroutines and good C API. Squirrel (http://squirrel-lang.org/) also seems like a nicer alternative to lua but it requires a C++ compiler.IMHO lua's best asset is the small and fast VM. I wish there would be other good, modern languages that target it.
for bitwise ops: look at 5.2, it has it now. 32-bit operations.
floating point arithmetic: in practice, I haven't seen it as a problem as soon as I stay within the 32-bit range - then the numbers can be represented exactly, so the abstraction works well.
OOP: can't say for it, I did not do it much.
For the "fast" - check luajit (http://luajit.org/) - it is near-native speed while remaining reasonably slow.
And the FFI in luajit is simply fantastic. Take a look at https://github.com/justincormack/ljsyscall which binds the syscalls.
The annoyance that I'd thought of is that the array indexing starts with one, not zero - this brings some headaches during the index calculations. But this also forces to rethink the logic to use more of iterators, and abstract away from the indices. So, after all, it is not that big of a deal.
I'm developing for an arm processor with no floating point support. so it's best to avoid the software fallback at all costs.
I'm aware of luajit but "plain" lua is still fast enough for my uses. FFI is definitely a killer and beats SWIG hands down.
need to upgrade to 5.2 asap...
I did not experiment with this myself though, but hopefully it might ease your woes with no FPU - http://luajit.org/performance_arm.html shows 85x speedup for md5, which I suppose would be integer algorithm.
Out of curiosity, what is the platform, if not a secret ?
-- Comment syntax is that a big deal?
- bit wise: LuaJIT?
- Just like in Python and Javascript, what's the issue?
Doubles do just fine as integers if you code so that
you always wind up with other integers.
- OOP - This I agree is a community fragmentation issue.Also, Python has separate integer and floating-point operations:
>>> type(1)
<type 'int'>
>>> type(1.0)
<type 'float'>I just started doing some Lua coding. So far nothing really off-putting, just a need to watch for habits picked up form other languages.
Biggest complaint is the lack of metaprogramming (e.g eval).
The js.js blog post mentions this and in mrbuy , the README has just been updated. Is social coding being taken to the extreme?
People who develop software of this caliber can easily afford the expense of a private Github repository if they want one.
Can anyone tell me how it's different from other ruby implementations? What does 'execute various environment' mean? Can I run it inside JVM like JRuby?
Here is more info on RiteVM http://www.reddit.com/r/ruby/comments/k9jce/ruby_ritevm_faq_...
As an aside, this sent me on a little adventure to http://www.mruby.com which is ... quite a treat.
Matt Ruby, Comedian, writer, and 37signals’ first employee.
Probably not a coincidence.
http://www.avocadodb.org/2012/04/20/using-mruby-as-alternati...
Disclaimer: I have never even read some Lua, honest question