[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] WebKit 20-50% slower than Chrome/Minefield using large Float32Array Arrays
- To: Stephen Bannasch <stephen.bannasch@deanbrook.org>
- Subject: Re: [Public WebGL] WebKit 20-50% slower than Chrome/Minefield using large Float32Array Arrays
- From: Kenneth Russell <kbr@google.com>
- Date: Thu, 17 Feb 2011 16:51:05 -0800
- Cc: Thatcher Ulrich <tu@tulrich.com>, public_webgl@khronos.org
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1297990991; bh=ehG80IBU+R5Gn7IzyXF3zQWhSuc=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Cc:Content-Type:Content-Transfer-Encoding; b=pY2yB8J9IawjC8iiXoc4cCWWrJPgpY82/O05RhCf700KTP8v/S7kIWH6jERza4wyz sa2w/bmevwme60EQHst9A==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qn+u6p4I2uVceQJnwQsRmknl8V7B5+VDi/x53JRL3Ww=; b=rwQEbFxgYb1K1jxBu915aC8czWIcRiazVoaQe00KgQkkgAVci+YGC6TqyZ8oRIC+// Pxo0czfRLLWjT/4BZUJg==
- Domainkey-signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Kko4ST7O6zzLFfcn+M+V8iQsKMJjF/oshZmDGXAA6hF6KctZWVw6/XchIDZfeTozc7 OllCUNnKUgdeayafYtBg==
- In-reply-to: <p06240820c9835e80a3dc@192.168.1.122>
- List-id: Public WebGL Mailing List <public_webgl.khronos.org>
- References: <p06240816c98262b859ca@192.168.1.122> <AANLkTin8wKjQyMTBANmRRoteKRmNtwD4VcBetzFX0RMu@mail.gmail.com> <p06240820c9835e80a3dc@192.168.1.122>
- Sender: owner-public_webgl@khronos.org
On Thu, Feb 17, 2011 at 4:16 PM, Stephen Bannasch
<stephen.bannasch@deanbrook.org> wrote:
>
> At 11:23 AM +0100 2/17/11, Thatcher Ulrich wrote:
>>Cool demo.
>>
>>One thing you should try, without even going to WebGL, is filling the
>>canvas using context.putImageData() instead of lots of fillRect calls.
>> Perhaps also best to render into a 100x100 canvas, and have the
>>browser scale it onto the correct size on the page, instead of doing
>>that in your paint routine.
>
> Thatcher,
>
> Thanks for the suggestion, it works much better. I implemented it and the canvas renderings is about 50% faster.
>
> https://github.com/stepheneb/seasons/blob/master/earth/model2d.js#L1960
>
>>The other thing you should definitely do is make a color table instead
>>of making and parsing "hsl(...)" strings for every pixel.
>
> The div-stuffing method is now slower than the canvas rendering but it wasn't that slow.
>
> The div-stuffing method pre-generates 256 css rules, inserts them into the stylesheet and 256 div strings and puts these into an array. Later when generating the string to insert with innerHTML I build it out of the pre-computed array of div strings that reference each of the 256 styles.
>
> But ... there's a new mystery! A colleague asked how much slower it would be if I didn't use typed arrays ... so now there are two alternate implementations that link to each other:
>
> http://visual-demos.dev.concord.org/seasons/earth/model2d.html
> http://visual-demos.dev.concord.org/seasons/earth/model2d-reg-arrays.html
>
> On my Chrome version 9 using regular arrays and rendering runs about 7.1 fps while using typed arrays is slower at only 5.4fps.
>
> On plain old Safari v5 I'm getting 3.6 fps.
>
> Without rendering Chrome 9 runs about 41 fps using regular arrays and only about 31 fps with the Typed Arrays. Minefield isreversed running about 41 fps using Typed and 28 fps using regular arrays.
>
> Regular Safari runs about 21 fps without rendering.
>
> http://visual-demos.dev.concord.org/seasons/earth/model2d-reg-arrays.html
>
> I have made a few other changes in the model but none that I thought would slow doiwn typed-arrays.
Just FYI, further optimizations are planned for typed arrays in V8.
Currently certain optimizations are done for normal JavaScript arrays
that aren't in place for typed arrays.
-Ken
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------