Ehsan Akhgari wrote:

On 2014-02-26, 4:52 AM, Neil wrote:

The one that I spotted is that MSVC is unable to optimise static variables, e.g. when you write static const length = ArrayLength(array); If you write this as a local then the compiler is able to optimise it away in release builds.

So you mean the problematic cases happen when that variable is at a global scope or something?

Doesn't have to be at global scope, could be static function scope (in which case you get a static constructor... at least at global scope it manages to optimise that away).

Note that I don't think that we need to care about the performance of ArrayLength() in non-optimized builds.

Debug builds are now sufficiently slow that I no longer dogfood them, but as it happens MSVC is able to optimise MOZ_ARRAY_LENGTH in both opt and debug builds.

Wanting faster debug builds is a good thing. I doubt that the subject of this thread will give you those though. :-)

Well, it was low-hanging fruit.

My suggestions: first, build with --enable-debug --enable-optimize.

That results in an undebuggable build, as the debugger won't be able to examine most variables, which rather defeats the object of debugging.

On 2014-02-24, 1:25 PM, Chris Peterson wrote:

To avoid developers and reviewers from having to remember special cases, maybe MOZ_ARRAY_LENGTH should just be the standard everywhere.

They're not quivalent.

Would you mind xpanding on that?

Sure.  mozilla::ArrayLength has a special case for mozilla::Array

That's readily fixed.

template <typename T, size_t N>
char (&ArrayLengthHelper(const Array </mozilla-central/ident?i=Array><T </mozilla-central/ident?i=T>, N </mozilla-central/ident?i=N>>& arr </mozilla-central/ident?i=arr>ay))[N];

Want me to file a bug?

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to