Closed ghost closed 2 years ago
It is pretty normal that a native code implementation will perform way better than an interpreted language ever could, especially in this case where a lot (and I really mean a lot) of computations are happening.
As for your question about passhrough: The qrencode
library does not support all the features which the BaconQrCode renderer does, so for this library that is out of scope. Of course, for your personal projects, you are free to just use a pass through if available.
Hi!
As part of researching ways of generating QR codes in my PHP application I did some simple performance tests comparing BaconQrCode against the CLI qrencode tool. I was expecting the BaconQrCode library to be faster than using
passthru
from PHP, but maybe it is not:/usr/bin/qrencode
The example code I used with the CLI tool:
For BaconQrCode 1.0.3 I used this script:
For BaconQrCode from master I used this script:
I tested both with BaconQrCode 1.0.3 and BaconQrCode master on PHP 7.4 (Fedora 32) by accessing the script through Apache+FPM-FPM using Apache Bench to check the performance:
Is this performance difference expected? Is there anything that can be done to improve the performance of BaconQrCode, maybe specific opcache configuration? Am I testing wrong? Can the PHP code be optimized? Is Composer the bottleneck? Although I tested with phpab directly as well, which didn't help much... Is there a good reason not to consider using
passthru
with/usr/bin/qrencode
?Thanks