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

*To*: Won Chun <wonchun@google.com>*Subject*: Re: [Public WebGL] comparing typed arrays*From*: Kenneth Russell <kbr@google.com>*Date*: Wed, 6 Jun 2012 12:13:32 -0700*Cc*: Brandon Jones <tojiro@gmail.com>, Fabrice Robinet <cmg473@motorola.com>, Florian Bösch <pyalot@gmail.com>, public_webgl@khronos.org*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record; bh=/toyASyT1JZaZdSKDPb1f1REnIK5cYfxV9Aikr5KxjQ=; b=ER8dR8PlB3FiesHrGjtuDO57IsbH4iH2IuA8bm3qF21wCDXNfaakhYek4dLnOV6J6j NRq56UNNIdo2z9qodsU5PNemCwK409yg9IWv8YrYUjOHzRSeJuD++8PM5VrMBE+9kIh3 Iswh0aauMtDF4IoT59QmJqyBNOXZsGLk/TsPUEErExb4BniDQy1bqdY2UJ/Si6KC+/jv NAAgct3w2W89ZNDLwmw5FrCrfjAh92pcqSY1fY7b0BCZqqNkRZco6Z5U/vt/AIThRCCr WH9kka9BbbZFFm7Dtoix51TJfOyZd7w219VOdUG+S4ihVmVYy+BErJlGM1Y8wEc/mT/M 5oyQ==*In-reply-to*: <CAB1dxyrTf4kWq6OCnj1B8otwKRxM4gm011pUxscoFNY=qC30+A@mail.gmail.com>*List-archive*: <https://www.khronos.org/webgl/public-mailing-list/archives/>*List-id*: Public COLLADA Mailing List <public_webgl.khronos.org>*List-owner*: <mailto:owner-public_webgl@khronos.org>*List-post*: <mailto:public_webgl@khronos.org>*List-subscribe*: <mailto:majordomo@khronos.org?body=subscribe%20public_webgl>*List-unsubscribe*: <mailto:majordomo@khronos.org?body=unsubscribe%20public_webgl>*References*: <CAPam9RqLeuNushbjg5F+5FzHZeDeszdcExUduqj_jZn9pOK71A@mail.gmail.com> <CAOK8ODg8T0=N+7B7PWYy8yJkbtxNCE+yH04p=QojVE=6tm7Mvw@mail.gmail.com> <CAPam9RpPvx2FMJ2OJnjGoY7yvuavEvoww64uHGeR9327LMS3pA@mail.gmail.com> <CAMttkKJnOXQipUWxTRy3J01aMwZSxn7B92gX+RSk-NdQcMS2fA@mail.gmail.com> <CAB1dxyrTf4kWq6OCnj1B8otwKRxM4gm011pUxscoFNY=qC30+A@mail.gmail.com>*Sender*: owner-public_webgl@khronos.org

On Wed, Jun 6, 2012 at 11:55 AM, Won Chun <wonchun@google.com> wrote: > On Wed, Jun 6, 2012 at 2:42 PM, Brandon Jones <tojiro@gmail.com> wrote: >> >> I'd like to point out that while I think a memcmp on typed arrays would be >> a really good idea, that may not accurately cover the case that you're >> describing Fabrice (comparing matrices). Given the quirks of floating point >> calculations if the matrices you were comparing had been calculated >> mathematically rather than copied directly from a static source you could >> easily introduce minor variations into the matrix elements that would cause >> a memcmp to fail. A more realistic (though unfortunately slower) usage would >> be to compare each value with a small epsilon to account for floating point >> jitter. >> >> Of course, that entirely depends on your use case. I'm just saying that >> while I fully support fast TypeArray comparisons I don't think it should be >> advocated for comparing vectors/matrices in general. > > > I agree with Brandon that you shouldn't use memcmp to compare floats, even > for _exact_ comparisons (true in Javascript as it is elsewhere). IEEE754 > includes a signed zero, that compare equal but have different bit > representations. > > In general, you want some kind of slop for floating point comparisons, but > element-by-element epsilons for transformation matrices might be > nonsensical. Better to do comparisons in a domain where transformations are > easily manipulated. Things like offset vectors or quaternions would use > absolute epsilons, scaling factors would use relative epsilons, etc. Fabrice, what are the use cases for a memcmp-like comparison between two typed array instances? The intent in the typed array spec is minimality. Functionality is only added when there are strong use cases. Note that Mozilla has proposed adding memset and memmove-like functionality to typed arrays to speed up Emscripten compiled applications: https://bugzilla.mozilla.org/show_bug.cgi?id=730873 https://bugzilla.mozilla.org/show_bug.cgi?id=730880 They're prototyping them to see whether they yield a speedup. If they do, that's strong motivation for adding them. BTW, discussion of typed arrays is welcome on this list, but you might consider emailing public-webapps@w3.org for a broader audience. -Ken > -Won > >> >> >> --Brandon >> >> >> On Wed, Jun 6, 2012 at 11:15 AM, Fabrice Robinet <cmg473@motorola.com> >> wrote: >>> >>> Hi Florian, >>> >>> On Wed, Jun 6, 2012 at 1:25 AM, Florian Bösch <pyalot@gmail.com> wrote: >>>> >>>> On Wed, Jun 6, 2012 at 8:18 AM, Fabrice Robinet <cmg473@motorola.com> >>>> wrote: >>>>> >>>>> Looking at the typed array spec I did not find a way to compare >>>>> (efficiently) 2 arrays, >>>>> Is that something that was considered and discarded for some reason ? >>>>> Or did it just not made it into the spec yet ? >>>> >>>> I don't know the reason why it's not in the spec. I would think it'd be >>>> useful if the comparison operator between typed arrays/views would make a >>>> range check and if matching performed a memcmp. >>> >>> >>> Indeed, specifying a range for the compare and underneath relying on >>> memcmp is *exactly* what I believe is missing. >>> >>> I'll follow up by filing an issue about this. >>> >>> Thanks, >>> Fabrice. >>> >> > ----------------------------------------------------------- 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 -----------------------------------------------------------

**Follow-Ups**:**Re: [Public WebGL] comparing typed arrays***From:*Fabrice Robinet <cmg473@motorola.com>

**References**:**[Public WebGL] comparing typed arrays***From:*Fabrice Robinet <cmg473@motorola.com>

**Re: [Public WebGL] comparing typed arrays***From:*Florian Bösch <pyalot@gmail.com>

**Re: [Public WebGL] comparing typed arrays***From:*Fabrice Robinet <cmg473@motorola.com>

**Re: [Public WebGL] comparing typed arrays***From:*Brandon Jones <tojiro@gmail.com>

**Re: [Public WebGL] comparing typed arrays***From:*Won Chun <wonchun@google.com>

- Prev by Date:
**Re: [Public WebGL] comparing typed arrays** - Next by Date:
**Re: [Public WebGL] comparing typed arrays** - Previous by thread:
**Re: [Public WebGL] comparing typed arrays** - Next by thread:
**Re: [Public WebGL] comparing typed arrays** - Index(es):