News for hackers. Stuff that matters.
Re:Why I Develop For The Mac by simonsarris on Sunday May 05, 2013 @03:30PM (#5659447)
> So I'm left with <canvas>, and <canvas> is slow.

I consider this a bit of a frustrating pseudo-myth. It's true canvas is slow compared to lots of native drawing, but its usually presented as a false equivalency issue. Canvas didn't set out to replace native drawing of hand-crafted OpenCL. It's an alternative to cross-platform graphics on the web, where you get Canvas or you get Flash (Or SVG or hobbling together colored DOM elements to animate while crying and eating ice-cream out of a gallon tub. We've been there. Don't lie.).

What's worse, looking at the videos demoing his Mac app[1], they don't even look like they'd need canvas levels of performance. They look like they'd work just fine in SVG. What's wrong in this case with the very good performance across many platforms (even tablets) of the SVG-backed RaphaelJS?[2]

Unless his app can do things he'd rather not demo, I'm guessing this post is moreso post-hoc rationalization of picking Mac as his preferred development platform. At the risk of being a bit rude, it's worth noting that he doesn't bother with all Desktops, just Mac, which causes further suspicion that this is really just a rationalization piece and not about performance.

(Unrelated to the post at hand, this canvas pseudo-myth also upsets me because I spend big chunks of free time helping people with their canvas work, and its almost always an issue on the programmer's part. This is fine, I've never fault a programmer for writing less-than-optimal code, but often programmers tend to contribute their voices to the chorus of "Canvas is slow", regardless of looking for fault prior to their declaration.)

[1] http://magicmaps.evanmiller.org/gallery.html

[2] http://raphaeljs.com/world/

Re:Why I Develop For The Mac by drewcrawford on Sunday May 05, 2013 @04:30PM (#5659629)
> What's wrong in this case with the very good performance across many platforms (even tablets) of the SVG-backed RaphaelJS?

So I attempted to determine the accuracy of this claim. I ran a benchmark from Kevin Roast [1] who seems to author a lot of Canvas demos. For each of the 8 tests in his benchmark, I recorded the FPS reading that I saw that was the lowest (e.g., framerate dropped to X at some point during the 5-second test).

Mac iPad

20fps 16fps

29fps 18fps

30fps 21fps

30fps 30fps

28fps 6fps

29fps 18fps

29fps 7fps

12fps 30fps

mean_mac = 25.875, median_mac = 29 mean_ipad = 18.25, median_ipad = 18

On the Mac side, I can see both sides of the issue. Arguably 26-29fps in a wide variety of situations is good enough for a wide variety of applications. At the same time, I can understand the author really wanting to blow past 29fps.

On the iPad side, the issue is more clear. I think most people would say that 18fps is unacceptable for a drawing application.

(If these numbers are contributing to the "pseudo-myth" of slow Canvas performance, please point me to a reasonable benchmark. This one is just the most comprehensive one that I found.)

> At the risk of being a bit rude, it's worth noting that he doesn't bother with all Desktops, just Mac, which causes further suspicion that this is really just a rationalization piece and not about performance.

He addresses the choice of the Mac platform in some detail in the "Drawbacks" and "Conclusions" section of the post. At the risk of being a bit rude, it's poor form to dismiss someone's reasoning as a "rationalization" without addressing the reasoning on the merits. To the extent that his choice of Mac over Windows et al is specious, it is not a claim that is supported by your comment.

[1] http://www.kevs3d.co.uk/dev/canvasmark/

Re:Why I Develop For The Mac by simonsarris on Sunday May 05, 2013 @04:59PM (#5659713)
In the sentence you quoted I'm referring to SVG, not canvas, and the "in this case" refers to mapping apps, not games. I never made any claims with regards to games.

In the test you quoted the goal is to stress it until it could only handle 30fps (it says so on the page), so you necessarily must see 30fps for the test to go on to the next one. That is why your median score on the Mac is 29fps, because it degrades smoothly on the desktop compared to a mobile device.

If you want to see many devices peg 60fps on the canvas (the rate imposed by requestAnimationFrame), you can use a demo like MS' Fish one.[1] Your Mac ought to get 60fps for 1000 fish on a 1920 x 1075 canvas with no sweat. This is not a very interesting test, and I don't know what it will look like on an iPad, but it more than enough accounts for any animation you might see in a mapping application.

[1] http://ie.microsoft.com/testdrive/performance/fishietank/

Re:Why I Develop For The Mac by Samuel_Michon on Sunday May 05, 2013 @06:11PM (#5659951)
“Your Mac ought to get 60fps for 1000 fish on a 1920 x 1075 canvas with no sweat.”

I just checked, and indeed, my new MacBook Air with external display ran it just fine at 60fps. My 3 year old Mac mini handled 45fps. My iPad 4 managed to crank out 25fps in a 981x644 window.

Re:Why I Develop For The Mac by cerales on Monday May 06, 2013 @06:29AM (#5661673)
Can you recommend any resources for writing performant code for canvas / SVG?
Re:Why I Develop For The Mac by iknight on Sunday May 05, 2013 @09:32PM (#5660524)
wow, thanks for the link.
Re:Why I Develop For The Mac by ricardobeat on Sunday May 05, 2013 @03:42PM (#5659491)
Yes, SVG is the perfect tool for this, and I bet there is no visualization library remotely as awesome as D3 for the desktop: https://github.com/mbostock/d3/wiki/Gallery
Re:Why I Develop For The Mac by Intermernet on Monday May 06, 2013 @05:06AM (#5661471)
You can use D3 on the desktop as far as I know. It's a JS library.
Re:Why I Develop For The Mac by ricardobeat on Monday May 06, 2013 @09:14PM (#5665926)
s/desktop/native desktop apps/