-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[dns-sd] Optimize memory usage of SRP client #8370
Merged
Damian-Nordic
merged 4 commits into
project-chip:master
from
Damian-Nordic:srp-allocator-main
Jul 17, 2021
Merged
[dns-sd] Optimize memory usage of SRP client #8370
Damian-Nordic
merged 4 commits into
project-chip:master
from
Damian-Nordic:srp-allocator-main
Jul 17, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
andy31415,
bzbarsky-apple,
chrisdecenzo,
hawk248,
jepenven-silabs,
LuDuda,
msandstedt and
pan-apple
July 14, 2021 07:58
Damian-Nordic
force-pushed
the
srp-allocator-main
branch
from
July 14, 2021 08:31
290ff11
to
c66c160
Compare
Damian-Nordic
force-pushed
the
srp-allocator-main
branch
from
July 14, 2021 10:02
c66c160
to
c71105b
Compare
msandstedt
approved these changes
Jul 14, 2021
saurabhst
approved these changes
Jul 14, 2021
andy31415
reviewed
Jul 14, 2021
andy31415
approved these changes
Jul 14, 2021
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h
Outdated
Show resolved
Hide resolved
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h
Outdated
Show resolved
Hide resolved
Damian-Nordic
force-pushed
the
srp-allocator-main
branch
from
July 15, 2021 06:36
308177c
to
2ef15a3
Compare
bzbarsky-apple
approved these changes
Jul 17, 2021
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h
Outdated
Show resolved
Hide resolved
Allocate all SRP service data from a single flat buffer instead of using an array of arrays. That way, less memory is used when entries of the same kind differ in size. Also, don't duplicate TXT entry keys as they are constants.
Damian-Nordic
force-pushed
the
srp-allocator-main
branch
from
July 17, 2021 07:37
2ef15a3
to
0669837
Compare
Switch to max(commissionable TXT key size, operational TXT key size) after optimizing memory usageconnectedhomeip/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h Lines 187 to 196 in 0669837
This comment was generated by todo based on a
|
Size increase report for "gn_qpg-example-build" from 4ef1ead
Full report output
|
Size increase report for "esp32-example-build" from 4ef1ead
Full report output
|
Size increase report for "nrfconnect-example-build" from 4ef1ead
Full report output
|
LuDuda
approved these changes
Jul 17, 2021
nikita-s-wrk
pushed a commit
to nikita-s-wrk/connectedhomeip
that referenced
this pull request
Sep 23, 2021
* [dns-sd] Optimize memory usage of SRP client Allocate all SRP service data from a single flat buffer instead of using an array of arrays. That way, less memory is used when entries of the same kind differ in size. Also, don't duplicate TXT entry keys as they are constants. * Address code review comments * Add TODO * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Current method of allocating data for the SRP services is inefficient, especially once we enable commisionable node advertising for Thread devices which involves both very short and very long TXT entries. In such a case we would allocate
N * max(TXT_VALUE_SIZE_i)
instead ofsum(TXT_VALUE_SIZE_i)
.Change overview
Allocate all SRP service data from a single flat buffer instead of using an array of arrays. That way, less memory
is used when entries of the same kind differ in size.
Also, don't duplicate TXT entry keys as they are constants.
Testing
Tested manually using nRF Connect Lock Example. Verified that both operational and commissionable advertising (the latter is not yet enabled by default). work correctly.
Fixes: #8366