statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 234 forks source link

Moving lookup of document base href outside of loop #982

Closed phil-scott-78 closed 2 years ago

phil-scott-78 commented 2 years ago

We can grab the base URL once outside of the LINQ chain which starts to add up especially with some link heavy documents in the API. This dropped the number of calls total on my run for GetElementsByTagName from 190,000 down to 9,000 and shaved a few seconds off the end of the runs.

daveaglick commented 2 years ago

Love it! Big performance gains often come from an accumulation of little performance gains like this (especially given that this analyzer is particularly slow right now). Not to mention the reduction in memory pressure reducing the calls by more than an order of magnitude. Nice work.