gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Matrix_...


From: Benjamin Wolsey
Subject: Re: [Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Matrix_...
Date: Wed, 11 Jun 2008 08:07:38 +0200

> Glad you see this point:)  Also, a self-designed 3*3 matrix would
> probably faster than the generic boost template, and can be easily
> maintained.
> 

I'm glad you've given me the opportunity to explain the implementation
too :)

The boost ublas templates are, according to their own measurements,
*marginally* slower (a few percent) than plain C arrays. In any case, to
work on AS matrices we have to do:

1. as_value -> double
2. multiplication of all the elements
3. double -> as_value

The boost matrix makes the implementation very minimal, as it's possible
to have a single method for filling a matrix with an object
(fillMatrix), and then a one-line way of concatenating them
(ublas::prod), rather than multiplying and adding the individual
elements.

Because matrix concatenation is very straightforward, there's not much
risk of a slow-down there with boost. I see no need to do the
calculations manually, because they are simple, ordinary operations, but
take up much space when there's no doubt what they should be doing.

As I said in one of my ChangeLog entries, Gnash is already much faster
than the PP for matrix calculations. It's also likely that the
bottleneck is in other operations (ptr->get_member between 6 and 12
times for each method).

Try this, for instance:

Matrix = flash.geom.Matrix;

m = new Matrix(12, 14, 3.4, 2.6, 15, 30);
m1 = new Matrix (2, 0, 0, 4, 4, 5);

start = new Date();
trace(start);
for (i = 0; i < 50000; i++)
{
    m.rotate(1);
    m.concat(m1);
    m1.invert();
    m.concat(m1);
    m.rotate(-1);
}
end = new Date();
trace (end.valueOf() - start.valueOf());
trace(m1);

-bwy

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]