Which option is faster...

jicman cabrera_ at _wrc.xerox.com
Mon Aug 5 07:16:03 PDT 2013


On Monday, 5 August 2013 at 14:13:33 UTC, Timon Gehr wrote:
> On 08/05/2013 03:59 PM, jicman wrote:
>>
>> Greetings!
>>
>> I have this code,
>>
>> foreach (...)
>> {
>>
>>   if (std.string.tolower(fext[0]) == "doc" ||
>>     std.string.tolower(fext[0]) == "docx" ||
>>     std.string.tolower(fext[0]) == "xls" ||
>>     std.string.tolower(fext[0]) == "xlsx" ||
>>     std.string.tolower(fext[0]) == "ppt" ||
>>     std.string.tolower(fext[0]) == "pptx")
>>    continue;
>> }
>>
>> foreach (...)
>> {
>>   if (std.string.tolower(fext[0]) == "doc")
>>     continue;
>>   if (std.string.tolower(fext[0]) == "docx")
>>     continue;
>>   if (std.string.tolower(fext[0]) == "xls")
>>     continue;
>>   if (std.string.tolower(fext[0]) == "xlsx")
>>     continue;
>>   if (std.string.tolower(fext[0]) == "ppt")
>>     continue;
>>   if (std.string.tolower(fext[0]) == "pptx")
>>    continue;
>>   ...
>>   ...
>> }
>>
>> thanks.
>>
>> josé
>
> They are both equally slow.

How would you make it faster in D1?


More information about the Digitalmars-d-learn mailing list