Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foreach vs AddRange
Message
De
11/08/2009 17:13:22
 
 
À
11/08/2009 16:54:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01417359
Message ID:
01417423
Vues:
40
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform