Skip to content

Conversation

@Shane32
Copy link
Owner

@Shane32 Shane32 commented May 19, 2024

This PR optimizes the speed and transient memory requirements required to note which modules are blocked and cannot be used by data. Previously a list of blocked areas was maintained, whereas now a bitmap of the entire QR code is maintaned. This results in much faster execution but consumes more memory. To compensate, a [ThreadStatic] reusable buffer is used to store the bitmap temporarily during QR code generation.

Requirements

This PR requires these other PRs to be merged in first, so GitHub will display a proper diff:

Before

Method Mean Error StdDev Gen0 Allocated
CreateQRCode 97.11 us 0.519 us 0.460 us 0.4883 9.3 KB
CreateQRCodeLong 1,679.91 us 16.805 us 14.897 us 1.9531 39.24 KB
CreateQRCodeLongest 14,336.49 us 35.724 us 31.669 us - 88.35 KB

After

Method Mean Error StdDev Gen0 Allocated
CreateQRCode 71.73 us 0.851 us 0.754 us 0.3662 7.27 KB
CreateQRCodeLong 1,314.42 us 9.245 us 8.195 us - 33.31 KB
CreateQRCodeLongest 7,216.75 us 29.611 us 26.250 us - 79.74 KB

@codebude
Copy link
Collaborator

image

@Shane32 I merged the other PRs as suggested, but it seems there's still a conflict. Can you pull the current master into your branch?

@gfoidl Another performance optimization. Would you mind doing a review?

@Shane32
Copy link
Owner Author

Shane32 commented May 19, 2024

@codebude No problem; done. (No conflicts in VS, but GitHub isn't quite as smart!)

Copy link
Collaborator

@gfoidl gfoidl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codebude codebude merged commit 8259416 into Shane32:master May 22, 2024
@codebude
Copy link
Collaborator

Thanks for your work and review @Shane32 & @gfoidl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance related enhancements or benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants