mw.loader.inspect already measures how many unused css rules there are in a module's stylesheets.
It'd be interesting to also report images that were embedded but are in rules that are not applied to the current page.
See also:
T121730: Audit use of @embed and remove where not needed (2019)