-
Notifications
You must be signed in to change notification settings - Fork 131
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
Parse event data without json #1001
Conversation
@Chaoba can you run some tests and record if CPU / mem usage is better? |
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.
Impressive amount of work!
Do we have any testing in place for this feature already?
If not, can we add?
sdk-base/src/main/java/com/mapbox/maps/extension/observable/model/DataSourceType.kt
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/model/DataSourceType.kt
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Outdated
Show resolved
Hide resolved
btw, @Chaoba do you have any chance to compare your solution with Kotlin serialization? |
interested in knowing this but not a requirement to close this one out. |
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Show resolved
Hide resolved
sdk/src/test/java/com/mapbox/maps/extension/observable/ObservableTest.kt
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Outdated
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Outdated
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Outdated
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/model/RequestType.kt
Show resolved
Hide resolved
sdk-base/src/main/java/com/mapbox/maps/extension/observable/ObservableExtension.kt
Outdated
Show resolved
Hide resolved
|
||
internal fun Map<String, Value>.nonNullStringWithUpperCase(name: String): String { | ||
return nonNullString(name).toUpperCase(Locale.US).replace(DASH, UNDERLINE) |
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.
What bothers me is that method is named upperCase
but it also replaces dash with underline aside from uppercasing the letters. Maybe rename it if not split to two separate methods?
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.
Right, this method actually gets and transforms the string to a valid enum value, which can be used to create an enum instance.
Change the method name to validEnumValue
Summary of changes
This pr removes json in
ObservableExtension
and parses the event data manually to improve the performance.Take
getMapIdleEventData
for example, before the change it will take 3213802ns to parse the data intoMapIdleEventData
, while with the solution in this pr, it will be 432447ns.User impact (optional)
Pull request checklist:
@JvmOverloads
,@file:JvmName
, etc).mapbox-maps-android
changelog:<changelog>Removes json in ObservableExtension and to improve the performance.</changelog>
.v10.[version]
release branch fix / enhancement, merge it tomain
firstly and then port tov10.[version]
release branch.Fixes: < Link to related issues that will be fixed by this pull request, if they exist >
PRs must be submitted under the terms of our Contributor License Agreement CLA.