3 Jul 14:04
Inling C/Fortran in Lua
steve donovan <steve.j.donovan <at> gmail.com>
2009-07-03 12:04:53 GMT
2009-07-03 12:04:53 GMT
Of course, luatcc does this already, but does not free you from having to write the binding code, such as would be generated by tolua++. Inling performance-critical code can be an effective trick: http://on-ruby.blogspot.com/2006/07/rubyinline-making-making-things-faster.html Now the question is, is it worth pursuing this for Lua? tolua++ works rather nicely, but you have to maintain a separate .c/.cpp file and hand-roll the .pkg file (the cleaned header). So, for proof-of-concept, I'd build on tolua++. After the first compile, a quick dependency check means that the inlined code need not be recompiled. One has to make sure that the .so/.dll is loadable from the same location as the original Lua file, etc. I've been generally thinking about Lua and High-Performance Computing. A library like this, plus MPI bindings, and one has a means to write very effective parallelized programs in a nicer language than FORTRAN. Actually, modern FORTRAN is a good companion to Lua in this context, since it's cleaner and faster than C, especially for things like bulk array operations and complex arithmetic. Any thoughts? steve d.
RSS Feed