Nicolas,
> I think there shouldn't be any difference between using array and objects.
Thanks for clarifying this (and for MTASC ;-).
> But actually, it's depending on the way
> field tables are implemented in Flash Player.
Mmm... Maybe I *should* make another test...
Thomas:
> Have you got an example ?
only did some superficial testing in Flash6 days. So I'm hardly 100% sure.
I think 'speed' in Flash-3D is mostly depending on how efficient the Matrix
calculations are.
Lets take most common 3D op: matrix(4x4) multiplication.
With Object's you have to do:
1. M[0][0] = (v.x * m.A.a) + (v.y * m.A.b) + (v.z * m.A.c) + m.A.d
2. M[0][1] = (v.x * m.B.a) + (v.y * m.B.b) + (v.z * m.B.c) + m.B.d
...
12. M[3][3] = (v.x) * etc.
With Array:
for(var i = 0; i < 4; i++) {
M[i][0] = (v[0] * m[i][0]) + (v[1] * m[i][1]) + etc...
M[i][1] = (v[0] * m[i][0]) + (v[1] * m[i][1]) + etc...
M[i][2] = (v[0] * m[i][0]) + (v[1] * m[i][1]) + etc...
M[i][3] = (v[0] * m[i][0]) + (v[1] * m[i][1]) + etc...
}
Question is: would there be difference in speed here? Guess if (Object ==
Array) there should not. Or would the implementation of fieldtables
(whatever they are) favour performance of one?
T
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
Nicolas Cannasse
Verzonden: donderdag 1 december 2005 16:32
Aan: Open Source Flash Mailing List
Onderwerp: Re: [osflash] class extends Array woes
Thomas wrote:
> Hi
>
>>>The code is part of a 3D-engine. Array-access is supposed to be faster
then
>>>Object-prop-access (did some testing on it).
>
>
> Are you sure ? Because I've made some tests too when I've developped
> matrix and vector class of sandy ( 3D engine available here :
> http://www.osflash.org/sandy ), but my tests showed that Array access
> is much slower.
>
> Have you got an example ?
> THanks
> THomas
Array access produces exactly the same bytecode as object access. That
means that a[0] is same as doing a.0 (if it was possible). Since Arrays
are also treated as objects, I think there shouldn't be any difference
between using array and objects. But actually, it's depending on the way
field tables are implemented in Flash Player.
Nicolas
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org