简体   繁体   English

Java语言引擎(或其他可嵌入语言),用于类似mongodb的查询执行环境和多线程

[英]Javascript engine (or other embeddable language) for mongodb-like query execution environment and multithreading

I need some embeddable language for tasks similar to query execution in mongodb. 我需要一些可嵌入的语言来完成类似于mongodb中查询执行的任务。 Language should be fast and it should have both JIT and interpreter (for frequent scripts that JIT-compiled and for one-time-run scripts too), should have in-memory runtime that I populate with specific API functions (or classes, whatever) by hand (and nothing "built-in" else like gettime, thread spawning or similar), it should have C API and it should work on ARM (MIPS also would be nice), not too big footprint also would be nice (but this is not critical). 语言应该是快速的,并且应该同时具有JIT和解释器(对于JIT编译的频繁脚本和一次性运行的脚本),还应该具有我使用特定API函数(或类,无论如何)填充的内存运行时。手工(没有诸如gettime,线程生成等类似的“内置”东西),它应该具有C API并且可以在ARM上运行(MIPS也会很不错),占用的空间也不会太大(但这并不重要)。

I have two candidates: 我有两个候选人:

  1. Google V8. Google V8。
  2. Spidermonkey (There was IonMonkey's ARM support announced AFAIK). Spidermonkey(宣布IonMonkey的ARM支持为AFAIK)。

I have not experienced embedding languages into C projects before so I have a few questions: recently there was a rumor that V8 is not thread-safe, is this problem still exists? 我以前没有在C语言中嵌入语言的经验,所以我有几个问题:最近有传言说V8不是线程安全的,这个问题仍然存在吗? If so, where that lack of thread-safe can cause problems? 如果是这样,那么缺乏线程安全性的地方会引起问题?

Also I would be glad if anyone suggested embeddable language which is more suitable for my requirements (except lua, I can't find any advantages in comparison with js except smaller footprint about what I don't care). 如果有人建议使用一种更适合我的需求的可嵌入语言,我也将很高兴(除了lua,与js相比,我看不到任何优势,除了对我不在乎的地方更小)。

I'm not sure how SpiderMonkey's multithreading embeddability compares to V8's, but I do know that it's possible to do with SpiderMonkey -- we have a few multiprogramming embedders on dev.tech.js-engine that you may want to post followup questions to. 我不确定SpiderMonkey的多线程可嵌入性与V8相比如何,但是我确实知道SpiderMonkey可以这样做-我们在dev.tech.js引擎上有一些多程序嵌入器 ,您可能希望将后续问题发布到其中。

Our web workers implementation in the browser uses one runtime instance per worker (you can multiply instantiate the runtime in a single process) -- we've moved away from an multithread-safe single-runtime approach over the past few years because it's unnecessary for the web and adds a significant amount of complexity to the engine. 我们在浏览器中的Web worker实现每个工人使用一个运行时实例(您可以在一个进程中实例化运行时)–过去几年,我们不再使用多线程安全的单运行时方法,因为对于Web并增加了引擎的复杂性。

An alternative to multiprogramming is also the asynchronous, select-based, run-to-completion approach a la node. 多重编程的替代方法也是基于节点的异步,基于选择的,从运行到完成的方法。

A nit: I don't think an interpreter is really a requirement of yours -- your requirement is fast start up times for one-off code. 的笨蛋:我不认为一个解释是真的就是你的要求 -你的需求的快速启动时间的一次性代码。 SpiderMonkey has an interpreter and V8 does not, but V8 has a fast-code-emission (which we tend to call "baseline") JIT compiler that offers comparable performance in that area. SpiderMonkey具有解释器,而V8没有,但是V8具有快速代码发射(我们通常将其称为“基线”)JIT编译器,在该领域具有可比的性能。 That capability is an important requirement for JS on the web in general. 通常,此功能是Web上JS的重要要求。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM