Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Evaluate performance of removing/adding constraints in updateScaleBar #14066

Closed
2 tasks
julianrex opened this issue Mar 8, 2019 · 2 comments
Closed
2 tasks
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage

Comments

@julianrex
Copy link
Contributor

Follow-on to PR #13911

Since the intrinsic content size of the scale may change frequently during a camera "fly to", we should revisit whether it's necessary to call -installScaleBarConstraints in updateScaleBar:

Since the scale bar constraints are set up with constants:

[updatedConstraints addObject:[view.widthAnchor constraintEqualToConstant:size.width]];
[updatedConstraints addObject:[view.heightAnchor constraintEqualToConstant:size.height]];

it shouldn't be necessary to remove and re-add the height and width constraints: instead it should be more performant to update the constraints' constant.

We should:

  • Evaluate the performance impact of the original change.
  • Compare with updating the constant value only.

/cc @lloydsheng @friedbunny

@lloydsheng
Copy link
Contributor

@julianrex I had a benchmark for the changes on an iPhone 7 device, It seems to have no impact on performance.

Before After
Commit 5ccc5b7 60ceac5
Performance image image

The benchmark code as below:

- (void)updateCenterCoordinate {
    CLLocationCoordinate2D coordinate = self.mapView.centerCoordinate.latitude <= 31 ? CLLocationCoordinate2DMake(60, 0) : CLLocationCoordinate2DMake(30, 180);
    __weak MBXOrnamentsViewController *wself = self;
    [self.mapView setCenterCoordinate:coordinate zoomLevel:16 direction:30 animated:true completionHandler:^{
        [wself updateCenterCoordinate];
    }];
}

@stale stale bot added the archived Archived because of inactivity label Oct 14, 2019
@stale
Copy link

stale bot commented Oct 14, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Oct 14, 2019
@friedbunny friedbunny added the performance Speed, stability, CPU usage, memory usage, or power usage label Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

3 participants