Repository navigation
Morph.PDFium 1.4.3; convert pages in parallel - #44
Merged
Merged
Conversation
Convert rendered and read pages one at a time, loading each page twice (once for its text, once inside RenderPage). It now goes through PdfiumDocument.ProcessPages: each wanted page is loaded once, rendered with page.Render and read, with the pages spread across cores; the results come back in page order and are added to the conversion from this thread, so PagedConversion need not be thread safe. Morph.PDFium 1.4.3 also brings grayscale PNGs for text pages, pooled render buffers and a per-image filter choice. Measured on a 149 page text document, converting the whole document went from 1.28 s to 0.72 s at 96 DPI and 3.35 s to 1.45 s at 200 DPI. The PNGs are different bytes but compare equal under SSIM, so no snapshots change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Picks up Morph.PDFium 1.4.3 and switches
Convertto its newProcessPages.Changes
Morph.PDFium1.4.2 → 1.4.3.Convertrendered and read pages one at a time, loading each page twice (once for its text, once insidedocument.RenderPage). It now callsdocument.ProcessPages(indices, …): each wanted page is loaded once, rendered withpage.Render(dpi)and read, with the pages spread across cores. Results come back in page order andconversion.AddPageis still called sequentially from the converting thread, so nothing inPagedConversionneeds to be thread-safe.IncludeImages/IncludeTextgating and page-subset behaviour are unchanged.Effect
Measured in Morph.PDFium's benchmarks on a 149-page text document, the text + render shape this converter uses:
ProcessPages(this PR)1.4.3 also writes text pages as grayscale PNGs (about 60% smaller). They are different bytes but SSIM-identical, so no
.verified.pngfiles change — all 25 tests pass as they are.