mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-15 23:32:37 +00:00
perf(measure): read a page's operators one at a time for snapping
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
80cd15b474
commit
7c9e006c82
1 file changed
+3
-2
@@ -1,6 +1,6 @@
|
||||
//! Bounded path extraction and snapping in PDF user space, including nested Form XObjects.
|
||||
use crate::{Point, Result, check_points, distance, invalid};
|
||||
use pdfcraft_content::{Matrix, parse};
|
||||
use pdfcraft_content::Matrix;
|
||||
use pdfcraft_cos::{Dict, Document, ObjRef, Object};
|
||||
use serde::Serialize;
|
||||
use std::collections::HashSet;
|
||||
@@ -336,7 +336,8 @@ impl Walker<'_> {
|
||||
let (x, y) = m.apply(x, y);
|
||||
[x, y]
|
||||
};
|
||||
for op in parse(data).ops {
|
||||
// One at a time: a heavy page holds gigabytes as a list of operators.
|
||||
for op in pdfcraft_content::ops(data) {
|
||||
if self.geometry.segs.len().saturating_add(path.segs.len()) >= self.limits.segments
|
||||
|| self.geometry.targets().saturating_add(path.targets()) >= self.limits.targets
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user