Selecting An Embedded Language

后端 未结 7 1830
遥遥无期
遥遥无期 2021-01-12 08:29

I\'m making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implem

相关标签:
7条回答
  • 2021-01-12 09:07

    you could probably create an embedded language using C++ templates and operator overloading, see for example ublas or ftensor matrix languages. i do not think python or other interpreted languages of is suitable for having numbercrunching/data processing.

    0 讨论(0)
  • 2021-01-12 09:08

    Lua is quite fast as it is. If you need more speed, try LuaJIT, which is excellent.

    0 讨论(0)
  • 2021-01-12 09:13

    Tcl was designed from the ground up to be an embedded language.

    0 讨论(0)
  • 2021-01-12 09:23

    I believe tcl and Rexx were both intended for this purpose.

    0 讨论(0)
  • 2021-01-12 09:25

    Yes, tons. Lua and Python seems to be the most popular:

    Embedding Lua

    • http://www.lua.org/pil/24.html
    • https://stackoverflow.com/questions/38338/why-is-lua-considered-a-game-language
    • Lua as a general-purpose scripting language?

    Embedding Python

    • http://docs.python.org/extending/embedding.html

    Embedding Tcl

    • http://wiki.tcl.tk/3474
    • http://wiki.tcl.tk/2265

    Embedding Ruby

    • How to embed Ruby in C++?

    Embed Perl

    • http://perldoc.perl.org/perlembed.html

    Embed JavaScript

    • http://spiderape.sourceforge.net/

    There are dozens of JavaScript engines around, this is just an example. Some of them are also frighteningly quick.

    0 讨论(0)
  • 2021-01-12 09:25

    I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external "agents"

    The performance drop will be noticeable, perhaps painful. If you can put the data into arrays and process it in batches using NumPy, it should be much faster.

    NumPy makes it super easy to do any kind of arithmetic a million times in a row. For example, squaring every element of an array is like this:

    >>> x = numpy.array([1, 2, 3, 4, 5, 6, 7])
    >>> x**2
    array([1, 4, 9, 16, 25, 36, 49])
    

    Super easy, and the tight inner loop here is actually implemented in C.

    Of course NumPy can also do more advanced number-crunching.

    0 讨论(0)
提交回复
热议问题