Skip to content

Hypapdf / Benchmarks

Benchmarks

Hypapdf is measured against every open-source .NET library that can read PDF text, on the same files, each in its own process. The results below come from the benchmark result files in the repository, with the hardware, versions and commands used.

Hypapdf preview at commit d38fdfc of vensas/hypapdfsynced

How the benchmarks are run, and why the numbers look the way they do

How to read these results

Content order and reading order
Content order returns text in the order the PDF draws it, like pdftotext -raw, and is what these benchmarks measure. Reading order groups text into blocks and orders them column by column; it costs about twice the time.
Memory figures
Each memory figure says what it measures. Figures of different kinds are not comparable.
  • Allocated: Memory allocated during the run (managed allocations).
  • Process peak: Peak memory of the whole process (RSS).

At a glance

  • Real-world documents283 msText of 1,298 pages (31 MiB), one threadAllocated 79.5 MB5.3x faster than PDFium, 7.3x faster than PdfPig, 10.8x faster than iText

At a glance: pdf.js test suite

  • pdf.js test suite493 ms692 small, often damaged files; 688 read2.8x faster than PDFium; PdfPig crashes on this suite

Real-world documents

Extract text, macOS

8 public documents, 31 MiB, 1,298 pages: 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 (fetch-corpus.sh)

Timelower is better · × vs best
  1. Hypapdf282.9 ms, best
  2. PDFium (PDFiumCore)1,503 ms, 5.3×
  3. PdfPig2,052.9 ms, 7.3×
  4. iText3,057 ms, 11×
  5. Docnet (PDFium)3,213.5 ms, 11×
Extract text, macOS
CaseTimeAllocatedPeak RSS
Hypapdf282.9 ms79.5 MB138.4 MB
PDFium (PDFiumCore)1,503 ms8.4 MB140.5 MB
PdfPig2,052.9 ms2,570.2 MB269.5 MB
iText3,057 ms6,855.6 MB395.3 MB
Docnet (PDFium)3,213.5 ms16.3 MB177.2 MB
Hardware
Apple M1 Max (10 cores), 64 GB, macOS 26
Runtime
.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
Method
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.
  • With pages in parallel on every core (MaxDegreeOfParallelism = 0), Hypapdf takes 85.3 ms, allocates 93.0 MB and peaks at 176.2 MB RSS.
  • MuPDF.NET ships no macOS arm64 binaries and is measured on Linux only.
  • PDFium and Docnet allocate little managed memory because their work happens in native code; peak RSS includes it.
  • Hypapdf, PdfPig, iText and PDFium return the same amount of text (3.24 million non-whitespace characters, within 0.1%).
  • The machine was running other work (load average 7 to 13) during the runs. Every library ran under the same load, and the ratios held across reruns.

Benchmark source code

Reproduce
cd dotnet/benchmarks && ./fetch-corpus.sh && ./run.sh --runs 7

Extract text, Linux

8 public documents, 31 MiB, 1,298 pages: 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 (fetch-corpus.sh)

Timelower is better · × vs best
  1. Hypapdf322.1 ms, best
  2. PDFium (PDFiumCore)1,752.2 ms, 5.4×
  3. PdfPig2,528.6 ms, 7.9×
  4. Docnet (PDFium)3,441.3 ms, 11×
  5. iText3,578.5 ms, 11×
  6. MuPDF.NET11,411.2 ms, 35×
Extract text, Linux
CaseTimeAllocatedPeak RSS
Hypapdf322.1 ms79.5 MB132.1 MB
PDFium (PDFiumCore)1,752.2 ms8.4 MB101.7 MB
PdfPig2,528.6 ms2,575.6 MB219.2 MB
Docnet (PDFium)3,441.3 ms16.3 MB127.9 MB
iText3,578.5 ms6,920 MB384.8 MB
MuPDF.NET11,411.2 ms1,953.7 MB202.4 MB
Hardware
Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64
Runtime
.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)
Method
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.
  • With pages in parallel on every core (MaxDegreeOfParallelism = 0), Hypapdf takes 116.3 ms, allocates 93.1 MB and peaks at 164.6 MB RSS.
  • MuPDF returns 2% less text than the other libraries.
  • The machine was running other work (load average 7 to 13) during the runs. Every library ran under the same load, and the ratios held across reruns.

Benchmark source code

Reproduce
podman build -t hypapdf-bench -f dotnet/benchmarks/Containerfile dotnet && podman run --rm hypapdf-bench

Open and count pages, macOS

8 public documents, 31 MiB, 1,298 pages: 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 (fetch-corpus.sh)

Timelower is better · × vs best
  1. Hypapdf22.8 ms, best
  2. PDFium (PDFiumCore)30.2 ms, 1.3×
  3. Docnet (PDFium)39 ms, 1.7×
  4. PdfPig107.5 ms, 4.7×
  5. iText623.9 ms, 27×
  6. PDFsharp1,121.7 ms, 49×
Open and count pages, macOS
CaseTimeAllocatedPeak RSS
Hypapdf22.8 ms32.8 MB113.2 MB
PDFium (PDFiumCore)30.2 ms0 MB99.6 MB
Docnet (PDFium)39 ms0 MB129 MB
PdfPig107.5 ms139.4 MB197.1 MB
iText623.9 ms487.1 MB313.5 MB
PDFsharp1,121.7 ms838.1 MB310.4 MB
Hardware
Apple M1 Max (10 cores), 64 GB, macOS 26
Runtime
.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
Method
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.
  • Hypapdf only reads the cross-reference data when a document is opened; everything else is parsed on first use.
  • The machine was running other work (load average 7 to 13) during the runs. Every library ran under the same load, and the ratios held across reruns.

Benchmark source code

Reproduce
cd dotnet/benchmarks && ./fetch-corpus.sh && ./run.sh --runs 7

Open and count pages, Linux

8 public documents, 31 MiB, 1,298 pages: 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 (fetch-corpus.sh)

Timelower is better · × vs best
  1. Hypapdf32.1 ms, best
  2. PDFium (PDFiumCore)34.3 ms, 1.1×
  3. MuPDF.NET48 ms, 1.5×
  4. Docnet (PDFium)49.4 ms, 1.5×
  5. PdfPig177.2 ms, 5.5×
  6. iText789.2 ms, 25×
  7. PDFsharp1,233.2 ms, 38×
Open and count pages, Linux
CaseTimeAllocatedPeak RSS
Hypapdf32.1 ms32.8 MB109.1 MB
PDFium (PDFiumCore)34.3 ms0 MB79.7 MB
MuPDF.NET48 ms0 MB118.5 MB
Docnet (PDFium)49.4 ms0 MB101.7 MB
PdfPig177.2 ms140.1 MB199.2 MB
iText789.2 ms487.1 MB325.1 MB
PDFsharp1,233.2 ms835.2 MB284.2 MB
Hardware
Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64
Runtime
.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)
Method
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.
  • The machine was running other work (load average 7 to 13) during the runs. Every library ran under the same load, and the ratios held across reruns.

Benchmark source code

Reproduce
podman build -t hypapdf-bench -f dotnet/benchmarks/Containerfile dotnet && podman run --rm hypapdf-bench

pdf.js test suite

Extract text from the pdf.js test suite, Linux

The pdf.js test suite: 692 small, often damaged or unusual files, 78 MiB

Timelower is better · × vs best
  1. Hypapdf492.7 ms, best
  2. PDFium (PDFiumCore)1,376.5 ms, 2.8×
  3. Docnet (PDFium)2,317.4 ms, 4.7×
  4. iText3,626.8 ms, 7.4×
  5. MuPDF.NET9,795.7 ms, 20×
Extract text from the pdf.js test suite, Linux
CaseTimeAllocatedPeak RSS
Hypapdf492.7 ms334.3 MB293.6 MB
PDFium (PDFiumCore)1,376.5 ms9.2 MB189.8 MB
Docnet (PDFium)2,317.4 ms6.3 MB189.8 MB
iText3,626.8 ms5,285.7 MB706.7 MB
MuPDF.NET9,795.7 ms1,180.5 MB287.3 MB
PdfPignot runnot runnot run
Hardware
Apple M1 Max, 8 vCPUs in a Podman container, Debian Linux arm64
Runtime
.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)
Method
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.
  • Files read: Hypapdf 688, MuPDF.NET 685, PDFium 683, Docnet 682, iText 644 of 692.
  • Hypapdf's 4 failures are password-protected or damaged files that Poppler's pdftotext gets no text from either.
  • PdfPig could not be measured: files such as issue19800.pdf end the process with a stack overflow, which .NET cannot catch.

Benchmark source code

Reproduce
podman run -v <corpus>:/corpus hypapdf-bench benchmarks/run.sh --runs 3 --task text --corpus /corpus

x86-64, emulated

Extract text, linux/amd64 emulated with Rosetta

8 public documents, 31 MiB, 1,298 pages: 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 (fetch-corpus.sh)

Timelower is better · × vs best
  1. Hypapdf498.5 ms, best
  2. PdfPig3,295.5 ms, 6.6×
  3. PDFium (PDFiumCore)4,013.3 ms, 8.1×
  4. Docnet (PDFium)4,269.2 ms, 8.6×
  5. iText5,200.5 ms, 10×
  6. MuPDF.NET13,441.3 ms, 27×
Extract text, linux/amd64 emulated with Rosetta
CaseTimeAllocatedPeak RSS
Hypapdf498.5 ms79.5 MB181.4 MB
PdfPig3,295.5 ms2,570.2 MB307.2 MB
PDFium (PDFiumCore)4,013.3 ms8.4 MB138.4 MB
Docnet (PDFium)4,269.2 ms16.3 MB157.3 MB
iText5,200.5 ms6,918.8 MB445.6 MB
MuPDF.NET13,441.3 ms1,953.7 MB246.4 MB
Hardware
Apple M1 Max, linux/amd64 container emulated with Rosetta, Debian Linux x86-64
Runtime
.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)
Method
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.
  • The x86-64 code runs emulated, so only the ratios between libraries mean anything, not the absolute times.

Benchmark source code

Reproduce
podman build --platform linux/amd64 -t hypapdf-bench-amd64 -f dotnet/benchmarks/Containerfile dotnet && podman run --rm --platform linux/amd64 hypapdf-bench-amd64 benchmarks/run.sh --runs 3 --task text --task open

Back to top