-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvement for QR rendering #384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your pull request. I made a quick review and found some things that should be improved before merging.
Apart from that, I could also reproduce the performance gains. Good job 👍
Furthermore, the second most expensive function is the
If we impose mask 0, this leads to again to huge performance gains:
|
Thank you for further researching and testing performance bottlenecks. It sounds good, but I'm not sure if it's the best idea to hardcode the masking pattern. After all, the readability of the QR code will suffer in most cases. Do you have a more in-depth knowledge about QR codes and do you know if this is safe to do? I don't really want to trade readability for performance. |
Yes, that's the problem... for 10/100 bills the performance gains are not justifiable as I think it's better to lose some time improving the readability of the code. After 1000 I don't know... |
I checked the specifications again. There is no mention about the masking patterns. But there are rules to minimum module size and error correction etc, so I would like to play it safe and stick to the expensive calculation for now. Im going to merge, feel free to open an issue if you want to further discuss this topic. |
It takes a lot of time to render a lot of QR Bills since addPath is an expensive function as we need to convert from QR segments to SVG and then to PDF.
We can bypass the conversion from QR to SVG, and directly convert QR segments to PDF.
This leads to huge performance benefits (a4.js):