Though there are many things left to be done on Puppeteer Sharp, I wanted to perform the first benchmark and see how Puppeteer Sharp is performing so far.
But, in order to say that Puppeteer (the Node version or Puppeteer sharp) is better than wkhtmltopdf, we need to prove 3 things: It’s faster, it produces a pdf of the same or better quality and it’s easier to use.
Each test generates 10 PDF fields and will be run 5 times.
I wanted to be able to run a process X times and then get the fastest, slowest, average and the standard deviation, something like wrk but for Windows processes. As I didn’t find any tool to help me, I coded my own; a Tiny process profiler. The idea is simple: run any process a pre-determined number of times, save the elapsed time of each run in a list and then show some stats.
These tests were run on a DELL XPS 15
- 7th Generation Intel® Core™ i7-7700HQ Quad Core Processor
- Windows 10 Pro 64-bit
- 16GB, 2400MHz, DDR4
- 512GB PCIe Solid State Drive
|Tool||Fastest Run||Slowest Run||Avg Run||Standard Deviation|
|Puppeteer Node JS||7.673||8.20||7.838||0.4472|
All values in seconds
Unlike Puppeteer (Node and Sharp), wkhtmltopdf doesn’t honor media print. This could be good or bad depending on your needs. A PDF file created by Puppeteer would be more like the PDF generated when you print a page to PDF in Chrome, whereas it would look more like a screenshot in wkhtmltopdf.
Puppeteer proved to be way faster; three times faster according to my tests. Puppeteer Sharp and Puppeteer have pretty much the same performance
Puppeteer (Node and Sharp) has a richer API than wkhtmltopdf. Though I used a process call to execute wkhtmltopdf there are many wrappers around wkhtmltopdf, such as the one coded by codaxy, but all of them are limited to the small API the process itself exposes
Don’t stop coding!