-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
boblight: reduce cpu time spent on memcopy and parsing rgb values #1016
boblight: reduce cpu time spent on memcopy and parsing rgb values #1016
Conversation
Hello @The-Master777 👋 I'm your friendly neighborhood bot and would like to say thank you for So that you and other users can test your changes more quickly, If you make changes to your PR, i create a new link to your workflow artifacts. Best regards, |
Here is your new link to your workflow artifacts. |
Here is your new link to your workflow artifacts. |
Here is your new link to your workflow artifacts. |
#endif | ||
|
||
// Clamp to byte range 0 to 255 | ||
return static_cast<uint8_t>(std::max(LO, std::min(HI, int(HI * d)))); |
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.
qmax and qmin would be qt alternatives?
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.
Here is your new link to your workflow artifacts. |
Thank you for your help to Hyperion. |
The amount of memory allocations in BoblightClientConnection is reduced drastically.
BoblightClientConnection used to perform a huge amount of memcopy-operations - mostly involving read only string data – that led to high CPU usage. Now QStringRef is used to store tokenized Boblight messages instead of creating read-only copies of such strings.
The parsing of RGB values (given as float-strings) is optimized to be allocation-free. This is archived using a native (thus performant) implementation based on QChar character values and mostly int-arithmetic.
What kind of change does this PR introduce? (check at least one)
If changing the UI of web configuration, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
Fixes: #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
Benchmarks show the number of CPU-Cycles consumed by memory allocation and parsing plummet significantly freeing valuable system resources. Measured on raspberry pi 4 with perf on debian AArch64, 10 seconds of real life boblight data, 600 LEDs.
Performance with refactoring:
Performance baseline: