Re: [Mono-list] Optimising some large loops using LINQ question

2013-04-24 Thread Andy York
If you do not need to work with a piece of data from a database my suggestion is always don't ask for it thus eliminating the need for the loop all together. Let the database do the work databases are good at. It looks like your not even after any of the data but only to see if the task id exis

Re: [Mono-list] Optimising some large loops using LINQ question

2013-04-24 Thread Alberto León
I suggest to store the result of db.getSubscription().Tasks in an IEnumerable or List Is possible that each time you pass for the condition in the loop you called anothertime getSuscription() So you are calling many times a high resources consumption task, that is a database action. 2013/4/24 Dav

Re: [Mono-list] Optimising some large loops using LINQ question

2013-04-24 Thread David Schmitt
On 24.04.2013 02:49, Paul Johnson wrote: Hi, I'm working on a project that has some very large loops in it that I'd like to remove and use some bits of LINQ to speed things up. The current code looks like this foreach (Task t in db.getSubscription().Tasks) { if (t.TaskID == task.TaskID)

[Mono-list] Optimising some large loops using LINQ question

2013-04-23 Thread Paul Johnson
Hi, I'm working on a project that has some very large loops in it that I'd like to remove and use some bits of LINQ to speed things up. The current code looks like this foreach (Task t in db.getSubscription().Tasks) { if (t.TaskID == task.TaskID) { foreach (ReadTask rt in