6 ms·
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
by CJefferson 16y ago
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.
- tlb 16y agoAt 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.
- kqr2 16y agoHave you looked into lua? It's a good embedded scripting language. http://www.lua.org/ http://www.lua.org/
- pygy_ 16y agoEspecially, 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/ http://luajit.org/
- nitrogen 16y agoAre 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.
- joeyo 16y agoThere 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.
- nitrogen 16y agoPPC 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?).
- pygy_ 16y agoThe 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).
- pjscott 16y agoAlso, the language itself is pleasant and straightforward. If you know other modern programming languages, Lua shouldn't be too surprising.
- DanielRibeiro 16y agoEver looked into Cython? http://www.cython.org/ http://www.cython.org/ Sage (a open source replacement for matlab) uses it quite successfully for speeding up critical paths.
- russell_h 16y agoThats 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-native-extensions/ https://www.cloudkick.com/blog/2010/aug/23/writing-nodejs-na...
- azakai 16y agoSyntensity moved from Python to JavaScript as an embedded scripting language, http://www.syntensity.com/toplevel/intensityengine/ 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 ;)