I have this method that retus true or false based on whether a website has any pages that have any exteal links.
The method does work. However, it is incredibly slow. Like it takes about 5 seconds to process a 100 websites with a combined total of 5000 pages.
protected bool WebsitesWithExtealLinks(int id)
{
var website = FetchModel(id);
if (website == null) retu false;
//retu true;
var extealLinks = website.WebPages
.Any(wp => wp.Links != null &&
wp.Links.ExtealLinks.Any());
retu extealLinks;
}
I've pinpointed the slowness is occuring somewhere in the linq query, but I'm not quite sure why it's happening. I have other linq queries that operate on WebSite and WebSage objects that are quite fast.
I'm not sure why this one is so slow.
Is there any way to speed up linq queries or replace them with something else?
Thanks!
