X[]==Y[] is 7X slower than it should be -- why?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat Jun 21 20:33:58 PDT 2008
"torhu" <no at spam.invalid> wrote in message
news:g3katb$14ee$1 at digitalmars.com...
> downs wrote:
>> 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.
>>
> I wish you didn't say that. Yet another undocumented feature to try to
> remember?
It's not undocumented. Look at the first slicing example here:
http://www.digitalmars.com/d/1.0/arrays.html
More information about the Digitalmars-d
mailing list