[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Typed Arrays & Strings



Is this really the same use case?  Cedric, I think you want something closer to https://bugzilla.mozilla.org/show_bug.cgi?id=572522 -- but I think the original request actually wanted the ability to insert true strings, not binary data disguised as strings, right?

    - Vlad

----- "Cedric Vivier" <cedricv@neonux.com> wrote:

> On Wed, Jun 30, 2010 at 08:58, < ry@tinyclouds.org > wrote:
> 
> I'm not married to my API (from which CommonJS Binary/F was derived)
> but for my use case (servers) being able to read and write strings
> from and to the buffer is important and quite sensitive to
> performance. I would like to offer up a non-browser implementation to
> Typed Arrays but I need a native API to deal with strings.
> 
> 
> I completely support this.
> 
> 
> Few weeks ago I was researching the same thing and made a prototype
> but didn't come up with a formal proposal yet.
> The goal of my prototype (running on Mozilla) was to see how much more
> efficient could binary loading get by being able to load XHR content
> directly with an insert(string data) method instead of going through
> the charCodeAt-loop kind of thing :
> 
> 
> Demo : http://neonux.com/webgl/binaryloader.html
> 
> 
> The interesting part being :
> 
> 
> xhr.overrideMimeType("text/plain; charset=x-user-defined"); ...
> var res = xhr.responseText;
> 		var len = parseInt(xhr.getResponseHeader("Content-Length"));
> 		var buf = new WebGLUnsignedByteArray(len);
> 
> 		var parsingStartTime = Date.now();
> 		if (this.forceCharCodeAt || !buf.insert) {
> 			for (var i = 0; i < len; ++i)
> 				buf[i] = res.charCodeAt(i) & 0xFF;
> 		} else if (buf.insert) {
> 			buf.insert(res);
> 
> 
> 
> Result was obviously consistently faster and allows 2x faster loading
> of large meshes and other binary data.
> 
> 
> Endianness issues can be resolved by inserting with right offsets and
> corresponding typed WebGL*Array on a same WebGLArrayBuffer.
> 
> 
> 
> 
> Regards,
-----------------------------------------------------------
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: