Canvas Performance: Titanium vs Google Chrome and Safari
I'm developing a desktop app using canvas and I've noticed that in Titaniun it runs much slower than in-browser (Google Chrome or Safari). Exactly the same code. (Using Mac by the way, although I've seen similar numbers of Windows builds of my app)
I should probably qualify "slower". My app is a game which attempts to run as fast as possible by using setInterval of 0 milliseconds. In Google Chrome this interval is called every 5 milliseconds with the current code. Using the elapsed time between calls I can calculate the frames per second that the game is running.
In Chrome, the game runs at ~200 FPS. In Safari, ~90 FPS. However, in Titanium it runs at ~50 FPS or lower. (Tested in the packaged versions of my Titanium app as well)
I realize this is somewhat vague and I don't have any specific code to point to, but the fact is that the exact same code runs slower in Titanium than in Chrome or Safari. (I am using zero Titanium specific code in my JavaScript)
Has anyone else experienced this? I really don't understand the internal workings of Titanium enough to know what's going on. Perhaps there is a good technical reason why Titanium can't execute as fast as Chrome or Safari?
I couldn't easily determine if Titanium uses V8 but judging by the performance numbers I'd wager that it doesn't.
It would be great if a Titanium dev could shed some light on why desktop Titanium apps might run so much slower than regular browsers.
Thanks for your time!
3 Answers
-
Now that Google has opensourced their V8 Javascript engine which is used in Chrome, it would be nice to see this put into the Titanium fork of WebKit. Since all Titanium apps rely heavily on Javascript it should really speed up things considerably, especially on mobile devices. To me this is just the logical step to take.
Just a thought for the Appcelerator team.
Cheers,
Angus -
If you could build a reproducible example we could profile it on our side. We'll probably be having another big desktop update in the next month or so with the latest WebKit update and a bunch of performance fixes.
-
Sorry, this isn't an answer, just wanted to say that speed is big factor for me too; would love to see V8 or a similar performance boost in Titanium Desktop.
Cheers!