Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Has anyone got any experience using javascript/V8 as a scripting language for a C++ app? We currently use python with boost::python bindings, but are finding we have to limit the amount of python code, as it is too slow.


Have you looked into lua? It's a good embedded scripting language.

http://www.lua.org/


Especially, for x86 and x64, where you can use LuaJIT.

LuaJIT2 is still in beta, but it is already very stable. Performance-wise, it is comparable to Haskell and Java.

http://luajit.org/


Are there any plans to port LuaJIT to ARM or LLVM? I see a couple of posts mentioning slow FP performance on ARM, but that could be solved with a technique like that used by LNUM.


The LLVM IR is too low level. It loses some context necessary to get the performance of the tailored JIT written by Mike Pall.

There is a separate effort to write a JIT complier for Lua on top of the LLVM, but the performance is not as good as LuaJIT, and reaching such a level will be very complex, (assuming it's possible).


There is sponsorship for a PPC LuaJIT port (targeting embedded systems, I believe) and Mike Pall has expressed interest in an ARM port in the past, but I don't know what the status of that is.


PPC LuaJIT sounds like it would be useful in console games (Why did the big three consoles switch to PPC just as Macs switched to Intel, anyway?).


Also, the language itself is pleasant and straightforward. If you know other modern programming languages, Lua shouldn't be too surprising.


Ever looked into Cython? http://www.cython.org/

Sage (a open source replacement for matlab) uses it quite successfully for speeding up critical paths.


Thats essentially what Node.js is, although with a heavy focus on asynchronous operation.

Check out: https://www.cloudkick.com/blog/2010/aug/23/writing-nodejs-na...


Syntensity moved from Python to JavaScript as an embedded scripting language,

http://www.syntensity.com/toplevel/intensityengine/

worked out very well there.

Of course the real examples are... web browsers, which are C++ apps that are scripted by a JavaScript engine. Seems to work good there as well ;)


At Anybots, we built all the real-time robot code in Python with performance-critical bits in C++ wrapped using boost::python. Server code is in pure Javascript on Node.JS. I haven't tried to integrate C++ into Node, but it looks easy.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: