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

Minor performance optimization during serialization into JSON format #1066

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

0xnm
Copy link
Member

@0xnm 0xnm commented Sep 30, 2022

What does this PR do?

I noticed a small issue in the related code: since JsonArray actually implements Iterable, is JsonArray branch will never be executed, because it goes after is Iterable branch.

By moving is JsonArray up we skip useless toJsonArray call which will create new object and copy elements there from the old object.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm 0xnm requested a review from a team as a code owner September 30, 2022 14:12
@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2022

Codecov Report

Merging #1066 (9b7d7a7) into develop (36fb6d6) will increase coverage by 0.02%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #1066      +/-   ##
===========================================
+ Coverage    83.24%   83.26%   +0.02%     
===========================================
  Files          272      272              
  Lines         9279     9279              
  Branches      1494     1494              
===========================================
+ Hits          7724     7726       +2     
+ Misses        1140     1138       -2     
  Partials       415      415              
Impacted Files Coverage Δ
...ndroid/core/internal/persistence/file/EventMeta.kt 80.00% <0.00%> (-10.00%) ⬇️
...ain/java/com/datadog/opentracing/PendingTrace.java 57.76% <0.00%> (-0.86%) ⬇️
...android/rum/internal/ndk/DatadogNdkCrashHandler.kt 88.11% <0.00%> (-0.54%) ⬇️
...rc/main/java/com/datadog/opentracing/DDTracer.java 56.07% <0.00%> (+0.42%) ⬆️
...tadog/android/core/internal/net/CurlInterceptor.kt 83.33% <0.00%> (+2.38%) ⬆️
...id/webview/internal/rum/WebViewRumEventConsumer.kt 86.05% <0.00%> (+9.30%) ⬆️

Copy link
Member

@mariusc83 mariusc83 left a comment

Choose a reason for hiding this comment

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

Good catch !!

@0xnm 0xnm merged commit a432210 into develop Oct 3, 2022
@0xnm 0xnm deleted the nogorodnikov/perf_optimization_during_serialization branch October 3, 2022 07:52
@xgouchet xgouchet added this to the 1.15.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants