Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foreach vs AddRange
Message
From
11/08/2009 17:13:22
 
 
To
11/08/2009 16:54:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01417359
Message ID:
01417423
Views:
41
>Gregory,
>Documentation says the reason " AddRange has some extra overhead". That overhead turn into gain if element count is high (near 100 elements the gap is closed and AddRange starts gain).
>Cetin

Ok, I see

So the art is finding the 'overhead'

I'll test a bit further tomorrow to find out when AddRange starts to be a better performer than foreach/Add

Thanks,


ps: Still - it's not what one would have expected

Update:

There should be less overhead in AddRange - I mean : it can start with finding out if sufficient space left in order to avoid the test fo revery item it adds
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform