问题描述
我正在制作一个应用程序,该应用程序使用多种不同的算法(代理)分析一个或多个系列的数据.我想到这些代理中的每一个都可以实现为单独的 Python 脚本,我在我的应用程序中使用 Python C API 或 Boost.Python 运行这些脚本.
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 implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app.
我有点担心运行时开销 TBH,因为我正在进行一些非常繁重的数据处理,我不想每次模拟都需要等待几分钟.我通常会进行数十万(如果不是数百万)次调用外部代理"的迭代;我是更好地对应用程序中的所有内容进行硬编码,还是性能下降可以容忍?
I'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external "agents"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable?
另外,除了 Python 之外,我还能使用其他任何解释性语言吗?
Also, are there any other interpreted languages I can use other than Python?
推荐答案
是的,吨.Lua 和 Python 似乎是最受欢迎的:
Yes, tons. Lua and Python seems to be the most popular:
嵌入 Lua
- http://www.lua.org/pil/24.html
- https://stackoverflow.com/questions/38338/why-is-lua-thinked-a-game-language
- Lua 作为通用脚本语言?莉>
嵌入 Python
- http://docs.python.org/extending/embedding.html
嵌入 Tcl
- http://wiki.tcl.tk/3474
- http://wiki.tcl.tk/2265
嵌入 Ruby
- 如何在 C++ 中嵌入 Ruby?
嵌入 Perl
- http://perldoc.perl.org/perlembed.html
嵌入 JavaScript
- http://spiderape.sourceforge.net/
JavaScript 引擎有几十种,这只是一个例子.他们中的一些人的速度也快得惊人.
There are dozens of JavaScript engines around, this is just an example. Some of them are also frighteningly quick.
这篇关于选择嵌入式语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!