X[]==Y[] is 7X slower than it should be -- why?

downs default_357-line at yahoo.de
Fri Jun 20 15:15:07 PDT 2008


Sean Kelly wrote:
> Are the braces really necessary for the comparison though?  I'd just do "X == Y."
> I wouldn't expect a speed difference, but the cycle count has be wondering if
> by adding the braces the generated code is cloning the arrays before comparing
> them or something like that.
> 
No, array[] is just the full slice, i.e. the equivalent of [0 .. $].

It's useful for static arrays, as it effectively turns them into dynamic ones.

> 
> Sean

--downs



More information about the Digitalmars-d mailing list