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.)
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to