SpiderMonkey vs JavaScriptCore vs?
我有一个 C++ 桌面应用程序(用 wxWidgets 编写),我想添加对某些脚本语言的支持。
脚本主要用于由用户提供的 JavaScript 代码进行字符串、数字和日期的运行时转换。
我想使用 JavaScript,因为它被广泛使用并且每个人都熟悉其语法。
谷歌搜索了一下,似乎我有两个选择:
- 来自 Mozilla 的 SpiderMonkey
- 来自 WebKit 的 JavaScriptCore
有人尝试过这些吗? 哪一个更容易设置? 您知道其他更适合我的需求的实现吗?
顺便说一句,我的目标是 Windows 和 Linux 平台。
I have a C++ desktop application (written in wxWidgets) and I want to add support for some scripting language.
Scripting would mostly be used for run-time conversions of strings, numbers and dates by user supplied JavaScript code.
I'd like to use JavaScript because it is widely used and everyone is familiar with the syntax.
Googling around, it seems I have two options:
- SpiderMonkey from Mozilla
- JavaScriptCore from WebKit
Has anyone tried those? Which one would be easier to set up?
Do you know of some other implementation that is better for my needs?
BTW, I target Windows and Linux platforms.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
还有 Google 的 V8 JavaScript 引擎,在 Linux 上构建得很好,嵌入 API 看起来也相当简单:(与 SpiderMonkey 相比,从未看过 JavaScriptCore API)
http://code.google.com/apis/v8/get_started.html
There is also Google's V8 JavaScript engine, builds nicely on Linux, embedding API seems quite straightforward too: (Compared to SpiderMonkey's, never looked at the JavaScriptCore API)
http://code.google.com/apis/v8/get_started.html
当然,你也可以使用 Lua,它不仅是专门为此设计的,而且比任何 JS 都要快得多。
此外,它还具有精心设计的语义、非常小的核心、简单的 C API、出色的可移植性、非常成熟的 JIT,我见过的最有帮助的在线社区等等......
Of course, you could also use Lua, which not only is designed specifically for this, it's vastly faster than any JS.
Also, it's has well-designed semantics, a very minimal core, simple C API, great portability, a very mature JIT, the most helpful online community I've seen, etc...
JavaScriptCore 具有稳定的 C API(和 ABI),并且已在 macOS 上可用(并用作)标准系统框架。
[编辑:哦,它作为一个独立的库在 Linux 和 Windows 上运行,尽管我相信只有 debian 才这样分发]
JavaScriptCore has a stable C API (and ABI), and has been available (and used as) a standard system framework on macos.
[edit: oh, and it works on linux and windows as a standalone library, although i believe only debian distributes it as such]