Skip to content

Commit

Permalink
Update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
attah committed Mar 2, 2024
1 parent 198ded8 commit 8b57b1e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -80,19 +80,20 @@ 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.

| | 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.
34 changes: 34 additions & 0 deletions bench.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8b57b1e

Please sign in to comment.