Another thing you can do that does help a lot with performance is to pre-allocate the requires size for the destination collection:
if (iconList.Count + iconObjects.Count > iconList.Capacity) iconList.Capacity = iconList.Count + iconObjects.Count; On Fri, Aug 10, 2012 at 5:29 AM, Nic Wise <n...@fastchicken.co.nz> wrote: > What iconObjects, and what does it do when you turn it into an IEnumerable? > > And what does .iconID do when called? Is it a field or a property? > > Those are the only 2 places I can see where it could go slow. You > could use a Stopwatch (system, diagnostics) to time the various bits. > > On 10 Aug 2012, at 01:24, ric3kg <rickgr...@mac.com> wrote: > > > I have the following code: > > foreach(Icon item in iconObjects) > > { > > iconList.Add(item.iconID); //iconID is a GUID string > > } > > > > I'm finding 197 records. It takes ~10 seconds to execute the loop and > > populate the list. Any thoughts on improving the performance? > > > > I've tried: > > iconList.AddRange(iconObjects.Select(y=> y.iconID)) > > But it takes the same amount of time. > > > > Thanks, > > Rick > > > > > > > > -- > > View this message in context: > http://monotouch.2284126.n4.nabble.com/Performance-question-tp4656453.html > > Sent from the MonoTouch mailing list archive at Nabble.com. > > _______________________________________________ > > MonoTouch mailing list > > MonoTouch@lists.ximian.com > > http://lists.ximian.com/mailman/listinfo/monotouch > _______________________________________________ > MonoTouch mailing list > MonoTouch@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/monotouch >
_______________________________________________ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch