Files
vectorcraft/crates/eps/src/import/data.rs
T
dotCooCoo 130bb35fce EPS import: measuring an image's data left out charges one operation per 16 bytes
Measuring the data of an image too large to hold charged one operation
per 256 decoded bytes. A program that measures the same 300 MiB of
compressed zeros in a loop decoded about 22.8 GB, about 72 passes,
before its budget ran out, and the reading took about 55 s.
measuring_data_too_large_to_hold_in_a_loop_runs_out_of_the_budget took
58 s alone and failed its 300 s guard in a loaded full test run.

Measuring now charges one operation per 16 decoded bytes, and stops at
what the budget still pays for at that rate. A program's budget grows by
64 operations per byte, so one image compressed up to 1024 to 1 is still
measured within what its own bytes add. The loop now runs out of the
budget in its fifth pass, and the test takes 3.6 s.

The test also checks how much was measured: more than one pass and at
most five. With the old rate it fails with 22781165568 bytes measured.
2026-11-27 20:15:49 -08:00

26 lines
746 B
Rust

//! Data the program reads: from itself (`currentfile`) through decoding filters, and images
//! sampled from it, from strings or from procedures.
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::cmyk::{Inks, jpeg_components};
use vectorcraft_doc::{ImageBlob, ImageObject, Node, NodeId, NodeKind, OpacityMask};
use vectorcraft_geom::Affine;
use super::graphics::{Space, process};
use super::interp::{Interp, matrix_of};
use super::lex::{Lexer, find, hex_decode};
use super::obj::{DictRef, Key, Obj, Op, PsError, Res, Shared, ps_err};
use crate::ps;
mod filters;
mod ops;
mod pixels;
pub(crate) use filters::Stream;
#[cfg(test)]
pub(crate) use ops::measured;