phoboslab / Ejecta

A Fast, Open Source JavaScript, Canvas & Audio Implementation for iOS
2.81k stars 322 forks source link

Why the performance is very bad with PIXI.js v4 in Ejecta ? #653

Closed finscn closed 8 years ago

finscn commented 8 years ago

Why the performance is very bad with PIXI.js v4 in Ejecta ?

I port the the http://www.goodboydigital.com/pixijs/bunnymark/ to Ejecta and Safari for iOS .

Test in Safari for iOS ,everything is OK , and the FPS is about 50. But in Ejecta , just 5 FPS.

Why ?

this is test case :

bunnymark.zip

put the "bunnymark" folder into App/example/

and index.js is

ejecta.include("example/bunnymark/e-bunnymark.js");

test.html is for Safari or other browser .

phoboslab commented 8 years ago

Without having looked at the source, I would guess that this demo is performance bound by JavaScript, not by rendering.

Remember, Ejecta can't use the JavaScript JIT. If there's a lot of stuff to be processed for each sprite, it will run slower in Ejecta than in the browser. I don't think there's anything we can do about it :/

finscn commented 8 years ago

Why is there no JIT in Ejecta ? And Is calling Native method in JS one reason of bad performance?

phoboslab commented 8 years ago

It's not allowed by Apple. JSC can't allocate writeable+executable memory, so it can't compile the JavaScript code; it has to be interpreted.

There is some performance penalty for calling a native method from JavaScript, but it's fairly insignificant. The bottleneck is the absence of the JIT.

finscn commented 8 years ago

:'( it's a pity. I think maybe it's time to move to Cordova . I've write many plugins & extensions of Ejecta , But now, they become uselessness , I want to cry ... tears....