Wed 30 May 2007 12:52:10 PM UTC, original submission:
THIS ITEM WAS REASSIGNED TO TASK #6955. Wish item: reduce FP consumption by caching matrix parameters instead of recalculating them
de Eric Hughes <eh@narthex.us>
per a gnash-dev <gnash-dev@gnu.org>
data 29/05/2007 18:38
when I looked at the
matrix code last month I did notice one thing I was going to recommend:
storing both canonical matrix parameters and the matrix itself and
computing the matrix only when necessary. In other words, treating the
matrix values as a cache. When matrix canonical values are assigned, all
the trigonometric function are recomputed, which is going to be the most
expensive operation of the lot.
Perhaps better: when assigning canonical values, check them against
existing canonical values. If the same, do nothing. If different, update
the value and invalidate the matrix values. When performing a matrix
operation, check validity first and recompute if necessary.
In the same vein, caching the sine and cosine of the canonical rotation
value means that changing only the scale wouldn't incur any new
trigonometric computation. In such a case the multiplications would dominate.
I don't know enough about how the matrix computations fit within the
overall control scheme of the player, but if they're in anything like an
inner loop, caching these calculations should significantly improve
performance.
|