-
Notifications
You must be signed in to change notification settings - Fork 72
refactor: Convert MPPersistenceController to Obj C #529
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
base: workstation/9.0-Release
Are you sure you want to change the base?
refactor: Convert MPPersistenceController to Obj C #529
Conversation
📦 SDK Size Impact ReportMeasures how much the SDK adds to an app's size (with-SDK minus without-SDK).
➡️ SDK size impact change is minimal. Raw measurementsTarget branch (workstation/9.0-Release): {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1784,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1700,"sdk_executable_impact_bytes":896,"xcframework_size_kb":8132}This PR: {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1744,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1660,"sdk_executable_impact_bytes":896,"xcframework_size_kb":7568} |
|
|
||
| NSArray<MPCookie *> *cookies = [NSArray arrayWithObjects:&cookiesVector[0] count:cookiesVector.size()]; | ||
| return cookies; | ||
| return [cookiesArray copy]; |
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.
Do we need to return copy of object?
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.
Isn't it correct to return a copy here for immutability? The return type of the function is NSArray not NSMutableArray
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.
Since the array is created locally and not stored anywhere, returning a copy doesn’t add meaningful immutability guarantees here and only introduces an extra allocation. Returning an NSMutableArray instance as NSArray is valid, as NSMutableArray is a subclass of NSArray. Mutability is defined by the contract exposed to the caller: the client only sees an NSArray interface.
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.
It’s not a big deal, but avoiding the extra copy would keep things simpler and slightly more efficient here.
…-MPPersistenceController
…-MPPersistenceController
Background
What Has Changed
Checklist
Reference Issue (For employees only. Ignore if you are an outside contributor)