Benchmarks
Speed and accuracy against other PDF libraries, measured in CI on every push.
GitHub Actions, Linux x86_64, 4 CPUs (CI run 47596797779). Times are medians of repeated runs in a fresh process, on one thread unless noted.
| Engine | Accuracy | 2,000 pages | 60,000 pages (100 MB) | 72 scans (200 MB) | Opens damaged and encrypted files |
|---|---|---|---|---|---|
| prasasti | 100% | 60 ms | 2.2 s | 3 ms | 3 of 3 |
| prasasti, 4 threads | 100% | 31 ms | 1.1 s | 2 ms | 3 of 3 |
| Poppler pdftotext | 100% | 475 ms | 16.9 s | 32 ms | 2 of 3 |
| pdfminer.six | 98% | 16.7 s | 2 of 3 | ||
| oxidize-pdf | 85% | 191 ms | 36.8 s | 209 ms | 2 of 3 |
| PyMuPDF (MuPDF) | 85% | 849 ms | 31.9 s | 544 ms | 3 of 3 |
| pypdfium2 (PDFium) | 85% | 815 ms | 26.8 s | 141 ms | 3 of 3 |
| pypdf | 85% | 2.9 s | 2 of 3 | ||
| pdf_oxide | 83% | 1.05 s | 45.2 s | 429 ms | 3 of 3 |
| lopdf | 69% | 684 ms | timed out | 142 ms | 3 of 3 |
An empty cell means that engine wasn't run on that file. The Python package runs within 5% of these numbers.
What's measured
- Accuracy: how close each engine's words, in order, come to the known text, averaged over six test files: plain prose, Unicode, two columns, tables, words without spaces and shuffled lines.
- 2,000 pages and 60,000 pages: the time to get all the text out of a generated file of that size.
- 72 scans: a 200 MB file shaped like a scanned book, one large image per page with the words in an invisible text layer on top, the way OCR software saves scans.
- Damaged and encrypted files: an RC4 file, an AES-256 file and a truncated file.
On the three big files (2,000 pages, 60,000 pages and the scans) every engine's output was checked against the known text, and prasasti recovered every word.
The test files and the scoring come from pdf-bench, which compares 54 PDF libraries across 11 languages.
Run it yourself
The comparison lives in bench/ in the repository and needs uv and a Rust toolchain.
uv run --project bench bench/fetch.py
uv run --project bench bench/generate.py
cargo build --release -p prasasti-cli
uv run --project bench bench/compare.pyWhy it's fast
- The file is memory-mapped, and objects are parsed only when something asks for them.
- Content streams are read without allocating per token.
- Fonts are parsed once per document, and their character and width tables are flat arrays.
- Pieces of text that continue each other are merged while the page is read, so layout works on lines, not single letters.
- Pages don't depend on each other, so
threads=0spreads them across every core.