-- Warning: May contain traces of nuts. _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform
Both ArrayLength and MOZ_ARRAY_LENGTH are typesafe when compiled as C++,
however ArrayLength has the disadvantage that it's not a constant
expression in MSVC. In unoptimised builds this is direly slow as the
templated function does not even get inlined, but even in optimised
builds the MSVC compiler is unable to completely optimise away static
variables. In particular, the variable is treated as if it is
forward-declared: the value is fetched from memory in each function that
uses it. (In my simple test there were enough registers to avoid
fetching the value more than once, but I don't know what happens if this
is not the case. And at least the optimiser was able to avoid creating
any static constructors.) Would it therefore be preferable to use
MOZ_ARRAY_LENGTH in such cases?
- Use of MOZ_ARRAY_LENGTH for static constants? Neil
- Re: Use of MOZ_ARRAY_LENGTH for static constants? Chris Peterson
- Re: Use of MOZ_ARRAY_LENGTH for static constants? Ehsan Akhgari
- Re: Use of MOZ_ARRAY_LENGTH for static constants? Neil
- Re: Use of MOZ_ARRAY_LENGTH for static constan... Ehsan Akhgari
- Re: Use of MOZ_ARRAY_LENGTH for static constan... Neil
- Re: Use of MOZ_ARRAY_LENGTH for static con... Ehsan Akhgari
- Re: Use of MOZ_ARRAY_LENGTH for static con... Neil
- Re: Use of MOZ_ARRAY_LENGTH for stati... Ehsan Akhgari
- Re: Use of MOZ_ARRAY_LENGTH for static constan... Neil

