Closed
Description
Bug Report
Iterating through IWindow.GetStyleCollection is slow if doing on multiple elements, this could be because _sheets is deferred or just because GetEnumerator is doing lots of work.
Prerequisites
- Can you reproduce the problem in a MWE?
- Are you running the latest version of AngleSharp?
- Did you check the FAQs to see if that helps you?
- Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g.,
AngleSharp.Css
for CSS support) - Did you perform a search in the issues?
For more information, see the CONTRIBUTING
guide.
Description
This relates to #51 where i was hoping to be able to cache the StyleCollection returned by IWindow.GetStyleCollection to significantly speed up the process of calling StyleCollection.ComputeDeclarations on every element in a document. However it is still just as slow.
Possible Solution
- Make ComputeDeclarations take a IEnumerable that could be pre calculated.
- Optionally 1 but return a IEnumerable from IWindow.GetStyleCollection.
Im happy to implement the change if that would help as if possible i would appreciate it if we could get this out in a patch version, but wanted to run potential solutions by you before creating a PR.