Skip to content
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

Refactor and optimize BlockedModules #530

Merged
merged 7 commits into from
May 22, 2024
Merged

Conversation

Shane32
Copy link
Contributor

@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
Owner

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
Contributor Author

Shane32 commented May 19, 2024

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

Copy link
Contributor

@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 codebude:master May 22, 2024
3 checks passed
@codebude
Copy link
Owner

Thanks for your work and review @Shane32 & @gfoidl

@Shane32 Shane32 deleted the speed2 branch May 22, 2024 20:05
@Shane32 Shane32 mentioned this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants