From 8b57b1e52a631017107e7f1c0f31601a03e6f849 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 2 Mar 2024 12:40:55 +0100 Subject: [PATCH] Update benchmarks --- README.md | 23 ++++++++++++----------- bench.txt | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 bench.txt diff --git a/README.md b/README.md index f755b41..169e789 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Build: ## pdf2printable vs the competition -(As of 2023-10-30) +(As of 2024-03-02) A bit of friendly comparison helps make sure the featureset is well-rounded and performance is on par. @@ -60,18 +60,18 @@ Not in the running: cups-filters (can't get them to run outside CUPS), Android/A ### Format support -| | PDF | Postscript | PWG | URF | PCLm¹ | PCL² | -| ------------- | --- | ------------ | --- | --- | ---------- | --------- | -| pdf2printable | ✔ | ✔ | ✔ | ✔ | ✘ | ✘ | -| ipptransform | ✔ | ✔³(WIP) | ✔ | ✔ | ✘ | ✔³ | -| mutool | ✔ | ✘ | ✔ | ✘ | ✔ | ✔ | -| jrender | ✘ | ✘ | ✔ | ✘ | ✔ | ✘ | +| | PDF | Postscript | PWG | URF | PCLm¹ | PCL² | +| ------------- | --- | ---------- | --- | --- | ---------- | --------- | +| pdf2printable | ✔ | ✔ | ✔ | ✔ | ✘ | ✘ | +| ipptransform | ✔ | ✔ | ✔ | ✔ | ✘ | ✔³ | +| mutool | ✔ | ✘ | ✔ | ✘ | ✔ | ✔ | +| jrender | ✘ | ✘ | ✔ | ✘ | ✔ | ✘ | Good printers should support PDF or PWG. After that, URF is the biggest enabler. 1. I have not yet seen a printer support PCLm and none of the other formats that pdf2printable supports. 2. PCL comes in many different dialects (even beyond the versions) so it might not work across all printers. -3. Pre-rasterized compatibility versions. +3. Pre-rasterized compatibility version. ### Features @@ -80,10 +80,11 @@ Good printers should support PDF or PWG. After that, URF is the biggest enabler. | pdf2printable | ✔ | ✔(6) | ✔ | ✔ | ✔(+stdin) | | ipptransform | ✔ | ✔(5) | ✔ | ✔ | ✔ | | mutool | ✘ | ✔(3?) | ✘ | ✔ | ✘ | -| jrender | ✘ | ✘(1) | ✘ | ✘ | ✘ | +| jrender | ✘ | ✘(1)³ | ✘ | ✘ | ✘ | 1. PWG, URF and PCLm printers may require the client to help transform backside pages for duplex printing, or they will come out incorrectly. 2. Two color modes (sRGB24 and sGray8) is enough for basically anything. +3. Jrender can be patched to do gray or bi-level, but the output is broken. ### Performance Measured with a representative 90-page document for PWG-raster at 600 DPI on a AMD 3950X. @@ -91,8 +92,8 @@ Measured with a representative 90-page document for PWG-raster at 600 DPI on a A | | Speed (RGB) | Speed (Gray) | Size (RGB) | Size (Gray) | | ---------------------- | ----------- | -------------| ----------- | ----------- | | pdf2printable | 9s | 9s | 152MB | 76MB | -| ipptransform | 27s | 27s | 159MB | 76MB | -| mutool (AA off) | 15s | 22s | 152MB | 76MB | +| ipptransform | 26s | 27s | 159MB | 76MB | +| mutool (AA off) | 19s | 26s | 152MB | 76MB | | jrender (600dpi patch) | 25s | N/A | 334MB¹ | N/A | 1. Antialiasing seems to be enabled and would account for the size difference. However, at these resolutions that doesn't really provide much benefit. For pdf2printable and mutool it can be optionally enabled/disabled. diff --git a/bench.txt b/bench.txt new file mode 100644 index 0000000..47c58db --- /dev/null +++ b/bench.txt @@ -0,0 +1,34 @@ +# pdf2printable +make -Bj$(nproc) +time ./pdf2printable -r 600 ~/reference.pdf out.pwg +time ./pdf2printable -r 600 -c gray8 ~/reference.pdf out.pwg + +# ipptransform +./configure +make -Bj$(nproc) +LD_LIBRARY_PATH=./cups/ time ./tools/ipptransform -m image/pwg-raster -r 600 -t srgb_8 ~/reference.pdf > out.pwg + +# jrender +./gradlew build -Dorg.gradle.java.home=/usr/lib/jvm/java-1.8.0-openjdk-amd64/ && unzip -o ./sample/jrender/build/distributions/jrender-*.zip +time jrender-*/bin/jrender ~/reference.pdf out.pwg + +# mutool + +diff --git a/sample/jrender/src/main/java/sample/jrender/Main.java b/sample/jrender/src/main/java/sample/jrender/Main.java +index 0fc678d..2dcf810 100644 +--- a/sample/jrender/src/main/java/sample/jrender/Main.java ++++ b/sample/jrender/src/main/java/sample/jrender/Main.java +@@ -29,7 +29,7 @@ import org.apache.pdfbox.rendering.ImageType; + import org.apache.pdfbox.rendering.PDFRenderer; + + class Main { +- private static final int DPI = 300; ++ private static final int DPI = 600; + private static final ImageType IMAGE_TYPE = ImageType.RGB; + private final static double RED_COEFFICIENT = 0.2126; + private final static double GREEN_COEFFICIENT = 0.7512; + + +make -Bj$(nproc) +time ./build/release/mutool convert -O resolution=600 -A 0 -o out.pwg ~/reference.pdf +time ./build/release/mutool convert -O resolution=600,colorspace=gray -A 0 -o out2.pwg ~/reference.pdf