# Performance

> How Hypapdf was benchmarked against PdfPig, PDFium, Docnet, iText, MuPDF.NET and PDFsharp, why it is fast, and how to reproduce the results.

Source: https://hypapdf.libs.vensas.de/docs/performance  
Last updated: 2026-12-02

Hypapdf is measured against every open-source .NET library that can read PDF text, on the same files, each in its own process. This page explains how, where the speed comes from and how to reproduce the results. The result tables are on [Benchmarks](https://hypapdf.libs.vensas.de/benchmarks).

## What was measured

- **PdfPig** 0.1.16 (`ContentOrderTextExtractor`), managed
- **iText** 9.8.1 (`SimpleTextExtractionStrategy`, the content-order strategy), managed
- **PDFium**, the engine of Chrome's PDF viewer: called directly through PDFiumCore 4688 with pdfium-binaries 160.0.8193, and through **Docnet.Core** 2.6.0
- **MuPDF.NET** 4.1.2 (MuPDF 1.28.6), on Linux only because it ships no macOS arm64 binaries
- **PDFsharp** 6.2.4, which has no text extraction and is measured for opening only

Not measured: Docotic.Pdf and IronPDF, which do not run without a licence key; other commercial libraries; and Free Spire.PDF, whose free edition reads only the first 10 pages of a document.

## The documents

- **Real-world documents:** the ISO 32000-1 specification, IRS Publication 17 and form 1040, two arXiv papers, *Free Culture* and two papers from the pdf.js test suite; 8 files, 31 MiB, 1,298 pages (`dotnet/benchmarks/fetch-corpus.sh`).
- **The pdf.js test suite:** 692 small, often damaged or unusual files, 77 MiB.

## Method

Each library runs in its own process, reads the documents one after another on one thread unless noted, and reports the best of several passes. The machine is an Apple M1 Max with .NET 10, natively on macOS 26 and on Linux arm64 in a Podman container. An x86-64 run in a `linux/amd64` container emulated with Rosetta shows the same order; because it is emulated, only its ratios mean anything.

| Benchmark | Machine | Runtime | Compared with |
| --- | --- | --- | --- |
| .NET, real-world documents | Apple M1 Max (10 cores), 64 GB, macOS 26; Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64 | .NET 10 (SDK 11.0.100); .NET 10 (SDK 10.0.404) | Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4, MuPDF.NET 4.1.2 (MuPDF 1.28.6) |
| .NET, pdf.js test suite | Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64 | .NET 10 (SDK 10.0.404) | Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4, MuPDF.NET 4.1.2 (MuPDF 1.28.6) |
| .NET, x86-64, emulated | Apple M1 Max, linux/amd64 container emulated with Rosetta, Debian Linux x86-64 | .NET 10 (SDK 10.0.404) | Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4, MuPDF.NET 4.1.2 (MuPDF 1.28.6) |

## Results in short

Text of the real-world documents on macOS: Hypapdf 283 ms, 85 ms with pages in parallel; PDFium 1,503 ms (5.3×), PdfPig 2,053 ms (7.3×), iText 3,057 ms (10.8×), Docnet 3,214 ms (11.4×). On Linux, MuPDF.NET takes 11,411 ms (35×). Hypapdf allocates 76 MiB for the text run, against 2.5 GiB for PdfPig and 6.5 GiB for iText.

Hypapdf, PdfPig, iText and PDFium return the same amount of text (3.24 million non-whitespace characters, within 0.1%); MuPDF returns 2% less.

On the pdf.js test suite, Hypapdf reads 688 of 692 files in 493 ms. Its 4 failures are password-protected or damaged files that Poppler's `pdftotext` gets nothing from either. PdfPig could not be measured, because files such as `issue19800.pdf` end the process with a stack overflow, which .NET cannot catch.

**Extract text, macOS**

| Case | Time | Allocated | Peak RSS |
| --- | ---: | ---: | ---: |
| **Hypapdf** | 282.9 ms | 79.5 MB | 138.4 MB |
| PDFium (PDFiumCore) | 1,503 ms | 8.4 MB | 140.5 MB |
| PdfPig | 2,052.9 ms | 2,570.2 MB | 269.5 MB |
| iText | 3,057 ms | 6,855.6 MB | 395.3 MB |
| Docnet (PDFium) | 3,213.5 ms | 16.3 MB | 177.2 MB |

_Apple M1 Max (10 cores), 64 GB, macOS 26; .NET 10 (SDK 11.0.100). Compared with Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4. Each library runs in its own process and reads the documents one after another on one thread; the time is the best of several passes. Allocated is managed memory allocated during the run; peak RSS is the peak resident set size of the process, including the runtime and native code. Source: https://github.com/vensas/hypapdf/blob/d38fdfcf5961be0e9aa4fff49172b9339f09b3c9/dotnet/benchmarks/results/real-world-macos-m1max.txt_

**Extract text, Linux**

| Case | Time | Allocated | Peak RSS |
| --- | ---: | ---: | ---: |
| **Hypapdf** | 322.1 ms | 79.5 MB | 132.1 MB |
| PDFium (PDFiumCore) | 1,752.2 ms | 8.4 MB | 101.7 MB |
| PdfPig | 2,528.6 ms | 2,575.6 MB | 219.2 MB |
| Docnet (PDFium) | 3,441.3 ms | 16.3 MB | 127.9 MB |
| iText | 3,578.5 ms | 6,920 MB | 384.8 MB |
| MuPDF.NET | 11,411.2 ms | 1,953.7 MB | 202.4 MB |

_Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64; .NET 10 (SDK 10.0.404). Compared with Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4, MuPDF.NET 4.1.2 (MuPDF 1.28.6). Each library runs in its own process and reads the documents one after another on one thread; the time is the best of several passes. Allocated is managed memory allocated during the run; peak RSS is the peak resident set size of the process, including the runtime and native code. Source: https://github.com/vensas/hypapdf/blob/d38fdfcf5961be0e9aa4fff49172b9339f09b3c9/dotnet/benchmarks/results/linux-arm64.txt_

**Open and count pages, macOS**

| Case | Time | Allocated | Peak RSS |
| --- | ---: | ---: | ---: |
| **Hypapdf** | 22.8 ms | 32.8 MB | 113.2 MB |
| PDFium (PDFiumCore) | 30.2 ms | 0 MB | 99.6 MB |
| Docnet (PDFium) | 39 ms | 0 MB | 129 MB |
| PdfPig | 107.5 ms | 139.4 MB | 197.1 MB |
| iText | 623.9 ms | 487.1 MB | 313.5 MB |
| PDFsharp | 1,121.7 ms | 838.1 MB | 310.4 MB |

_Apple M1 Max (10 cores), 64 GB, macOS 26; .NET 10 (SDK 11.0.100). Compared with Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4. Each library runs in its own process and reads the documents one after another on one thread; the time is the best of several passes. Allocated is managed memory allocated during the run; peak RSS is the peak resident set size of the process, including the runtime and native code. Source: https://github.com/vensas/hypapdf/blob/d38fdfcf5961be0e9aa4fff49172b9339f09b3c9/dotnet/benchmarks/results/real-world-macos-m1max.txt_

**Open and count pages, Linux**

| Case | Time | Allocated | Peak RSS |
| --- | ---: | ---: | ---: |
| **Hypapdf** | 32.1 ms | 32.8 MB | 109.1 MB |
| PDFium (PDFiumCore) | 34.3 ms | 0 MB | 79.7 MB |
| MuPDF.NET | 48 ms | 0 MB | 118.5 MB |
| Docnet (PDFium) | 49.4 ms | 0 MB | 101.7 MB |
| PdfPig | 177.2 ms | 140.1 MB | 199.2 MB |
| iText | 789.2 ms | 487.1 MB | 325.1 MB |
| PDFsharp | 1,233.2 ms | 835.2 MB | 284.2 MB |

_Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64; .NET 10 (SDK 10.0.404). Compared with Hypapdf 0.1.0, PdfPig 0.1.16, PDFiumCore 4688 (pdfium-binaries 160.0.8193), Docnet.Core 2.6.0, iText 9.8.1, PDFsharp 6.2.4, MuPDF.NET 4.1.2 (MuPDF 1.28.6). Each library runs in its own process and reads the documents one after another on one thread; the time is the best of several passes. Allocated is managed memory allocated during the run; peak RSS is the peak resident set size of the process, including the runtime and native code. Source: https://github.com/vensas/hypapdf/blob/d38fdfcf5961be0e9aa4fff49172b9339f09b3c9/dotnet/benchmarks/results/linux-arm64.txt_

## Why it is fast

- The file stays in memory and is parsed lazily, straight from bytes: no stream abstraction, no tokens as objects.
- The lexer parses numbers in a single pass; names are interned per document without locks on lookup.
- Fonts are compiled once per document into code-indexed tables of widths and Unicode strings, so a glyph costs two array reads; text is appended without allocating per glyph.
- Page content is inflated (and decrypted) into pooled buffers; the text builder is reused per thread.
- Pages are independent and the document is thread-safe, so `ExtractText` can use every core.

## Text quality

Hypapdf extracts text in content order, like `pdftotext -raw`, inserting spaces and line breaks from the glyph positions. Over the 210 files of the pdf.js test suite with text, its output matches `pdftotext -raw` (Poppler) with a word-level F1 of 0.95 weighted by length. Most of the remaining differences are files where one of the two produces garbage (custom encodings without ToUnicode), dot leaders, or annotations Poppler draws differently.

## Limits of these figures

All figures come from one Apple M1 Max that was running other work (load average 7 to 13) during the runs. Every library ran under the same load, best of several passes, and the ratios held across reruns. There is no native x86-64 measurement yet.

## Reproduce

```bash
cd dotnet/benchmarks && ./fetch-corpus.sh && ./run.sh
```

Or build the container from `dotnet/benchmarks/Containerfile`. The raw output is in `dotnet/benchmarks/results/` in the [repository](https://github.com/vensas/hypapdf).
