On Wed, Jun 4, 2014 at 1:17 AM, Rik Cabanier <caban...@gmail.com> wrote:

>
>
>
> On Tue, Jun 3, 2014 at 3:48 PM, Till Schneidereit <
> t...@tillschneidereit.net> wrote:
>
>> On Wed, Jun 4, 2014 at 12:26 AM, Rik Cabanier <caban...@gmail.com> wrote:
>>
>>> > Actually, inverse() is already spec'd to throw if the inversion fails.
>>> In
>>> > that case (assuming we keep it that way) there is no need at all for
>>> any
>>> > isInvertible kind of method. Note that in floating-point arithmetic
>>> there
>>> > is no absolute notion of invertibility; there just are different matrix
>>> > inversion algorithms each failing on different matrices, so
>>> "invertibility"
>>> > only makes sense with respect to one inversion algorithm, so it is
>>> actually
>>> > better to keep the current exception-throwing API than to introduce a
>>> > separate isInvertible getter.
>>> >
>>>
>>> That would require try/catch around all the "invert()" calls. This is
>>> ugly
>>> but more importantly, it will significantly slow down javascript
>>> execution.
>>> I'd prefer that we don't throw at all but we have to because SVGMatrix
>>> did.
>>>
>>
>> That isn't really true in modern engines. Just having a try/catch doesn't
>> meaningfully slow down code anymore. If an exception is actually thrown, a
>> (very) slow path is taken, but otherwise things are good.
>>
>> (I can only say this with certainty about SpiderMonkey and V8, but would
>> assume that other engines behave similarly. And even if not, it doesn't
>> make sense to make decisions like this based on their current performance
>> characteristics.)
>>
>
> Interesting!
> I wrote a small experiment: http://jsfiddle.net/G83mW/14/
> Gecko is indeed impervious but Chrome, Safari and IE are not. V8 is
> between 4 and 6 times slower if there's a try/catch.
>

Ah, I stand corrected on V8, then. I know that they have some optimizations
in place for try/catch, but they're apparently less effective than ours.
I'm sure it's only a matter of time until this stops causing slowdowns in
any engine.


>
> I agree that we shouldn't make decision on the current state. (FWIW I
> think that exceptions should only be used for "exceptional" cases.)
>

That's true, yes. Also, given that you all would rather not have exceptions
here for other reasons, this seems to all be moot anyway. :)
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to