sergey-tihon / Clippit

Fresh PowerTools for OpenXml
https://sergey-tihon.github.io/Clippit/
MIT License
50 stars 19 forks source link

Slides Publishing #2

Closed sergey-tihon closed 4 years ago

sergey-tihon commented 4 years ago

The goal of this PR is to improve speed of slide publishing.

Base Line

PPTX file with 51 slide and 14.2 MB using code

var doc = new PmlDocument(srcDoc);
for (var i = 0; i < 51; i++)
{
    var source = new SlideSource(doc, i, 1, true);
    var slide = PresentationBuilder.BuildPresentation(new List<SlideSource> { source });
    slide.SaveAs(srcDoc.Replace(".pptx", $"_{i+1:000}.pptx"));
}

takes about

image

and create 51 file with total size 39.4 MB In the same time PowerPoint 2013 create 51 file with total size 16.0 MB

Size grow looks very aggressive - 177% vs 12.6% Time also kind of slow, because it Open source document for each slide extraction - 51 time.

image
sergey-tihon commented 4 years ago

Current results

image

vs slightly less memory pressure

image
sergey-tihon commented 4 years ago

Current result us about 6x perf improvement for 54decks with 652 MB in total image

After processing all 54 decks, I've extracted 2641 slides with total size 679 MB. (about 4% size grow)