How about V8 interpreter ?


#1

As i searched V8 and SpiderMonkey benchmark.

Always V8 won in many tests.

e.g ) http://favo.asia/2012/01/v8-vs-spidermonkey/

Also i tested very simple fibonaci benchmark.

function fib(n) {
if(n 0 || n 1)
return 1
return fib(n - 1) + fib(n - 2);
}
>
function start(f) {
>
t = new Date();
f();
print (“time”, new Date() - t, ‘ms\n’);
}
start(function () { fib(38); });
>

SpiderMonkey based js shell result: time 45489ms
V8 shell node result: time 538 ms

SpiderMonkey is about 84 slower in this simple task.

And V8 has easier API and examples and docs.

I didn’t get why cocos2d-x team choose SpiderMonkey as js bindings.

Could you explain why?


#2

V8 can’t be run on iOS since v8 uses JIT by force and iOS doesn’t support JIT :frowning:


#3

I have ported an interpreter version of V8. It can run on iOS smoothly with out jailbreak.
You can see:
http://jacos2d-x.org/jchome/?page_id=12


#4

Yep, but the version of v8 in jacos2d-x is too old. It’s about a year ago.
And we are using spidermonkey which is being updated frequently(one version in 6 weeks), and it also supports JIT on android.

Thai-Duong Nguyen wrote:

I have ported an interpreter version of V8. It can run on iOS smoothly with out jailbreak.
You can see:
http://jacos2d-x.org/jchome/?page_id=12