Bacon / BaconQrCode

QR Code Generator for PHP
BSD 2-Clause "Simplified" License
1.82k stars 208 forks source link

Slow $writer->writeFile locally, didn't test on the server #136

Open elnath78 opened 1 year ago

elnath78 commented 1 year ago

I'm writing a simple 2FA and when I pass the Uri to be printed as .svg file I averaged 1.76 seconds to save it to disk. I'm wondering if this is normal or if there is something I could do, this is how I timed it:

$renderer = new ImageRenderer(
    new RendererStyle(300),
    new SvgImageBackEnd()
);

$writer = new Writer($renderer);

$start_time = microtime(TRUE);

$writer->writeFile($uri, 'qrcode.svg');

$end_time = microtime(TRUE);

echo $end_time - $start_time;
DASPRiD commented 5 months ago

That sounds awfully slow, but I cannot reproduce that. This should be rather in the 1.76 millisecond area, not seconds.

elnath78 commented 5 months ago

That sounds awfully slow, but I cannot reproduce that. This should be rather in the 1.76 millisecond area, not seconds.

I was on Windows 10 running XAMPP if this can help you, what test did you do?

DASPRiD commented 5 months ago

I ran your code on my local Linux machine. If the issue is Windows specific, I won't be able to assist there.