Skip to content
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

Use Android View instead of runtime styling for way name #1621

Merged
merged 1 commit into from Dec 19, 2018

Conversation

danesfeder
Copy link
Contributor

@danesfeder danesfeder commented Dec 11, 2018

Closes #1222 Closes #1173

This PR replaces the MapWayName runtime styling implementation with an Android View .xml implementation. This aims to improve map performance as update the map way name layer with a new bitmap every time we have a new way name is expensive.

TODO:

  • Fix / add tests
  • Add javadoc
  • Before / after performance comparison

@danesfeder danesfeder added ⚠️ DO NOT MERGE PR should not be merged! refactor backwards incompatible Requires a SEMVER major version change. labels Dec 11, 2018
@danesfeder danesfeder added this to the v0.25.0 milestone Dec 11, 2018
@danesfeder danesfeder self-assigned this Dec 11, 2018
@danesfeder danesfeder force-pushed the dan-wayname-view branch 2 times, most recently from 78bd24e to 65e97a6 Compare December 13, 2018 20:52
@codecov-io
Copy link

codecov-io commented Dec 13, 2018

Codecov Report

Merging #1621 into master will decrease coverage by 0.19%.
The diff coverage is 25.3%.

@@             Coverage Diff             @@
##             master    #1621     +/-   ##
===========================================
- Coverage     23.84%   23.65%   -0.2%     
+ Complexity      735      714     -21     
===========================================
  Files           194      191      -3     
  Lines          8303     8214     -89     
  Branches        610      605      -5     
===========================================
- Hits           1980     1943     -37     
+ Misses         6137     6092     -45     
+ Partials        186      179      -7

@danesfeder danesfeder changed the title [WIP] Use Android View instead of runtime styling for way name Use Android View instead of runtime styling for way name Dec 13, 2018
@danesfeder danesfeder added ✓ ready for review and removed ⚠️ DO NOT MERGE PR should not be merged! labels Dec 13, 2018
@danesfeder danesfeder force-pushed the dan-wayname-view branch 2 times, most recently from 7aee6b0 to 725df7d Compare December 13, 2018 21:49
@danesfeder
Copy link
Contributor Author

@Guardiola31337 @devotaaabel this is ready for review - I'm working on test coverage.

Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great @danesfeder

While testing this, I've noticed that the pill shows up empty at the beginning 👀

empty_pill

I've also left some minor comments / questions.

codecov.yml Outdated
- "**/LaneStyleKit.java"
- "**/LaneStyleKit.java"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated.

@@ -18,6 +19,8 @@

void updateWaynameVisibility(boolean isVisible);

void updateWaynameView(@NonNull String wayName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, should we call this method updateWayNameView instead of updateWaynameView? If so, we should also update ☝️ updateWaynameVisibility or is this to avoid SemVer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was mainly to avoid SemVer - worth it to break?


String retrieveWayname() {
return wayname;
String retrieveWayName() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method 'retrieveWayName()' is never used

if (waynameLayer != null) {
createWaynameIcon(wayname, waynameLayer);
}
void updateWayNameWith(String wayName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method 'updateWayNameWith(java.lang.String)' is never used

@danesfeder danesfeder force-pushed the dan-wayname-view branch 3 times, most recently from 52fb41b to 177bb1c Compare December 17, 2018 15:15
@Guardiola31337
Copy link
Contributor

Thanks for addressing the feedback @danesfeder

  • Before / after performance comparison

I'm getting some numbers for ☝️ after that we can 🚀

@Guardiola31337
Copy link
Contributor

Working on #1621 (comment) I've noticed that we're not hiding the pill after calling NavigationView#stopNavigation. Should we? I believe so, right @danesfeder?

@danesfeder danesfeder force-pushed the dan-wayname-view branch 2 times, most recently from 70ce0d9 to a92926a Compare December 18, 2018 16:38
@danesfeder
Copy link
Contributor Author

@Guardiola31337 yeah good call on #1621 (comment)

I updated the code to hide the "pill" if NavgationView#stopNavigation is called

@danesfeder danesfeder removed this from the v0.25.0 milestone Dec 18, 2018
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me 👍

  • Before / after performance comparison

I'm finishing up getting the numbers for the comparison but we shouldn't let it block the PR. I'll report back here when I finish so we can 👀 the performance 📈 from these changes.

Thanks for the great work here @danesfeder

Copy link
Contributor

@devotaaabel devotaaabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Not sure why we didn't do this to begin with. I didn't test it but I trust @Guardiola31337 's testing skills

@danesfeder danesfeder merged commit 012452f into master Dec 19, 2018
@danesfeder danesfeder deleted the dan-wayname-view branch December 19, 2018 23:23
@Guardiola31337 Guardiola31337 mentioned this pull request Dec 20, 2018
12 tasks
@Guardiola31337
Copy link
Contributor

Had the chance to analyze the numbers 🎉📈🎉

Results were obtained after running the same (automated) navigation session / route 30 times with and without OP's fix in a Nexus 5 👀

Power use

estimated_power_use_mah

Average improvement 👉 2.096666667 mAh
Max improvement 👉 6.2 mAh
Min improvement 👉 1.5 mAh

CPU usage

cpu_usage

Average improvement 👉 13.79310345%
Max improvement 👉 25%
Min improvement 👉 -1%

90% of the samples have improved

Note 👇 for understanding percentages greater than 100% shown in the graph

%CPU -- CPU Usage : The percentage of your CPU that is being used by the process. By default, top displays this as a percentage of a single CPU. On multi-core systems, you can have percentages that are greater than 100%. For example, if 3 cores are at 60% use, top will show a CPU use of 180%. See here for more information. You can toggle this behavior by hitting Shift + i while top is running to show the overall percentage of available CPUs in use.

Source for above quote.

cc @danesfeder @andrlee @akitchen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards incompatible Requires a SEMVER major version change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants