Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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!

— asked May 31st 2010 by Geoff Blair
  • canvas
  • performance
1 Comment
  • I've created a gist containing a simple canvas performance demo html file. Download the html file and open it locally in any browser to try it out. (And replace index.html with it in an empty Titanium project)

    http://gist.github.com/421904

    The settings for number of boxes and such can be tweaked in the JavaScript code.

    Here are the numbers I'm seeing: (All on Mac OSX 10.6.3)

    Milliseconds between frames: (Smaller is better)

    • Chrome 5.0.375.55: ~22-23
    • Safari 4.0.5: ~30-35 (sometimes as high as ~40)
    • Titanium 1.2.1: ~55-60
    • Firefox 3.6.2: 60-90 (Just for comparison)
    — commented June 2nd 2010 by Geoff Blair

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

    — answered June 1st 2010 by Angus Peart
    permalink
    0 Comments
  • 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.

    — answered June 1st 2010 by Jeff Haynie
    permalink
    1 Comment
    • Thanks for the response. Looking forward to any desktop performance updates! See my comment on the original post for example code.

      — commented June 2nd 2010 by Geoff Blair
  • 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!

    — answered June 3rd 2010 by Matt Hackett
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.