-
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
[Darwin] MTRDevice attribute storage should store values by cluster #32765
[Darwin] MTRDevice attribute storage should store values by cluster #32765
Conversation
PR #32765: Size comparison from 4e582fc to cc80b77 Decreases (1 build for efr32)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, stm32, telink)
|
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.
"each attributes with their own keys," should be "each attribute with its own key" in the commit message, no?
PR #32765: Size comparison from 4e582fc to 8edbf80 Increases (4 builds for k32w)
Full report (13 builds for cc32xx, k32w, mbed, nrfconnect, qpg, stm32)
|
PR #32765: Size comparison from 4e582fc to bcaf6ca Increases (6 builds for efr32, k32w)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, stm32, telink)
|
typedef NSDictionary<NSString *, id> * MTRDeviceResponseValueDictionary; | ||
typedef NSDictionary<NSString *, id> * MTRDeviceDataValueDictionary; |
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.
Please let's not have this be public API for now... There are some issues with having public typedefs (like promising that the names will stay stable, etc)... For now, we should just have the typedef in one of the project headers and then think about the public API aspect.
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.
Addressed in #32778
return [NSString stringWithFormat:@"<MTRDeviceClusterData: dataVersion %@ attributes count %lu>", _dataVersion, static_cast<unsigned long>(_attributes.count)]; | ||
} | ||
|
||
- (nullable instancetype)initWithDataVersion:(NSNumber * _Nullable)dataVersion attributes:(NSDictionary<NSNumber *, MTRDeviceDataValueDictionary> * _Nullable)attributes |
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.
Please document that the number is the attribute id.
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.
Addressed in #32778
This PR changes the attribute storage from storing each attributes with their own keys, to storing them by clusters. This should reduce the number of writes significantly.
Should this test well, there are some follow up changes to consolidate how the in-memory read cache is represented to using the
MTRDeviceClusterData
class. But for now I'm keeping this structure in case we want to switch back to by-attribute storage.