Live demo of Web Bloat Score Calculator: https://www.webbloatscore.com/
How to run the project
If you don’t choose the default install location (C:\Program Files\Mozilla Firefox 48\firefox.exe), you need to let SlimmerJS know by modifying the WebBloatScore/Slimerjs/slimmer.bat file on lines 202 and 203 with the path you chose during the installation.
After that you can simply run the WebBloatScore ASP.NET MVC application.
As described on https://www.webbloatscore.com/, the web bloat score is calculated as
WebBS = TotalPageSize / PageImageSize
In the project the calculation is happening in the SlimmerExecutor class:
- First SlimmerJS is executed. It creates and stores a screenshot of the web page and returns the total size of the page.
- After that PngQuant library is used to optimize the screenshot of the page.
- In the end the result with all values necessary to calculate WebBS is returned.
The tasks necessary to calculate the score are time-consuming and depending on the hardware can take several minutes to complete. Therefore the timeout is used to limit the execution time. On top of that caching of the most used websites is used to save resources.