Repository navigation
Give each line chunk only the operator that painted it - #759
MaximPlusov merged 1 commit into
Conversation
processLineArts copied the window's whole operator list onto every line chunk in it: L lines times P paint operators StreamInfo objects. A window is everything painted between two text or XObject boundaries, so one chart drawn without text in between reaches thousands of both. A 55-page paper (one form with 7,500 strokes) made 56 million copies and ran out of a 2 GB heap in parseChunks; a 2.6 MB document made 325 million and failed at 5 GB. Over a 200-document corpus, 5 documents needed more than 2 GB for these copies alone. A line now carries one StreamInfo, for its own paint operator, and the full list goes once onto the window's LineArtChunk, as it already did. Memory is L + P instead of L x P. This changes what a consumer sees on a line, and one relies on it: odl-pdfua's SemanticMapper builds a figure from a region's lines and needs the whole window, curves and fills included. It is changed alongside to find the window's LineArtChunk through the line's operator, and through the box when the key is ambiguous (a form drawn twice, or two forms sharing a resource name). Land that change before this one ships. Only data-loader mode is affected (StaticContainers.isDataLoader), so validation is unchanged. opendataloader-pdf's own tagger does not read line art stream infos: its tagged PDFs are byte-identical before and after on the documents that completed before, and the two that did not now complete in under 300 MB. Not changed here: parseLineArts, used when MCIDs are not ignored (core's --use-struct-tree), still copies the stream's unmarked operators onto every separate box, boxes x operators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
1.31.206 adds one commit to 1.31.200 (veraPDF/veraPDF-validation#759): each line chunk carries only the operator that painted it, instead of a copy of every paint operator in its window. The copy was lines x operators StreamInfo objects and ran out of heap in parseChunks on documents with large vector charts. wcag-algorithms stays pinned at 1.31.47; 1.31.206 changes only ChunkParser in wcag-validation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
ChunkParser.processLineArtscopies the window's full paint-operatorStreamInfolist onto every line chunk in the window. A window is everything painted between two text or XObject boundaries, so this makes L lines × P operators objects. A chart drawn without text in between reaches thousands of both:parseChunks.The copying came in with 5d59d2d (integration) and e4ddb18 (jakarta).
Change
processLineChunk: when MCIDs are ignored and data-loader mode is on, a line chunk gets oneStreamInfo, for the operator that painted it.processLineArts: the L × P copy loop is removed. The window'sLineArtChunkstill gets the full list, once.Memory goes from L × P to L + P. Validation mode is unchanged (
StaticContainers.isDataLoadergate).Dependency
The change alters what a consumer sees on a line chunk. One consumer relies on the old shape: odl-pdfua's
SemanticMapperbuilds figures from lines and needs the whole window. opendataloader-project/odl-pdfua#171 changes it to find the window'sLineArtChunkthrough the line's operator. That PR is merged and released in odl-pdfua 0.2.15, so this change can ship.Evidence
The diff was applied to v1.31.200 and jakarta-v1.31.177, and only
ChunkParser.classwas replaced in the runtime jars. Runs usedOpenDataLoaderPDF.processFilewith a tagged-PDF config, in a 4 GB container.-Xmx2048m-Xmx2048m-Xmx1g)Review notes
LineArtChunkinstead.wcag-validationhas no test module, so no regression test was added.parseLineArtspath (MCIDs not ignored), line chunks now also get their own operator. Nothing reads them there.parseLineArtsstill copies the stream's unmarked operators onto every separate box (boxes × operators).🤖 Generated with Claude Code
Summary by CodeRabbit