W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2008

[whatwg] Canvas performance issue: setting colors

From: Sjoerd Visscher <sjoerd@w3future.com>
Date: Tue, 30 Sep 2008 10:09:45 +0200
Message-ID: <74CCFAFC-1DD4-4BA3-80CF-B651BDC467D8@w3future.com>
I guess this applies to the other methods and attributes of canvas as  
well. The majority of canvas methods are constructed in a way that  
allows an almost direct mapping to a C/C++ call. So when all the  
canvas code is perfectly optimized, the color code will probably still  
be the bottleneck. Unless you say that serializing floats to string  
and concatenating them and then parsing the string again can be done  
just as fast as creating and destructing a color object.

On Sep 30, 2008, at 12:53 AM, Oliver Hunt wrote:

>
>> I think the canvas api should get 2 new methods:
>>
>> CanvasColor createRGBAColor(in float r, in float g, in float b, in  
>> float a)
>> CanvasColor createHSLAColor(in float h, in float s, in float l, in  
>> float a)
>>
>
> WebKit already has a non-standard function -- setFillColor(r, g, b,  
> a) -- that provides a faster mechanism to set the colour, however we  
> believe we can rather easily improve the performance of the standard  
> fillStyle, strokeStyle properties and just have not yet gotten round  
> to it.  Until we have improved this I would be hesitant to go around  
> adding entirely new object types (especially canvas specific ones).
>
> --Oliver
>

--
Sjoerd Visscher
sjoerd at w3future.com
Received on Tuesday, 30 September 2008 01:09:45 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:05 UTC