Skip to content

Optimize output stream encoding. #1423

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

Merged
merged 2 commits into from
Apr 3, 2020
Merged

Optimize output stream encoding. #1423

merged 2 commits into from
Apr 3, 2020

Conversation

vkryachko
Copy link
Member

  • Use a BufferedWriter which drastically speeds up json encoding, as the
    encoder makes a lot of one-character writes so not buffering them
    leads to significant uft-8 encoding overhead.
  • Encode directly into the connection as opposed to an intermediate
    byte array.
  • Switch to try-with-resources for better resource safety

* Use a BufferedWriter which drastically speeds up json encoding, as the
  encoder makes a lot of one-character writes so not buffering them
  leads to significant uft-8 encoding overhead.
* Encode directly into the connection as opposed to an intermediate
  byte array.
* Switch to try-with-resources for better resource safety
@googlebot googlebot added the cla: yes Override cla label Apr 3, 2020
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 3, 2020

Binary Size Report

Affected SDKs

SDKTypeBase (4491f0a)Head (2518e80)Diff
firebase-inappmessagingapk (release)3552426.003552236.00-190.00 (-0.01%)
apk (aggressive)852122.00852405.00+283.00 (+0.03%)
protolite-well-known-typesapk (aggressive)122388.00122384.00-4.00 (-0.00%)
firebase-segmentationapk (aggressive)1017149.001017130.00-19.00 (-0.00%)
firebase-storageapk (aggressive)325638.00325620.00-18.00 (-0.01%)
firebase-commonapk (aggressive)82954.0082949.00-5.00 (-0.01%)
firebase-crashlytics-ndkapk (release)1937473.001937531.00+58.00 (+0.00%)
apk (aggressive)1170695.001170745.00+50.00 (+0.00%)
transport:transport-backend-cctaar38343.0038357.00+14.00 (+0.04%)
firebase-databaseapk (aggressive)325613.00325602.00-11.00 (-0.00%)
firebase-crashlyticsapk (release)1354464.001354614.00+150.00 (+0.01%)
apk (aggressive)583646.00583862.00+216.00 (+0.04%)
firebase-installationsaar56405.0056409.00+4.00 (+0.01%)
apk (aggressive)84602.0084600.00-2.00 (-0.00%)
firebase-dynamic-linksapk (aggressive)327448.00327459.00+11.00 (+0.00%)
firebase-installations-interopapk (aggressive)61717.0061716.00-1.00 (-0.00%)
firebase-componentsapk (aggressive)10949.0010962.00+13.00 (+0.12%)
firebase-abtapk (aggressive)85721.0085719.00-2.00 (-0.00%)
firebase-configapk (aggressive)395835.00395828.00-7.00 (-0.00%)
firebase-datatransportapk (release)711393.00711405.00+12.00 (+0.00%)
apk (aggressive)116361.00116378.00+17.00 (+0.01%)
firebase-inappmessaging-displayapk (release)4818234.004818362.00+128.00 (+0.00%)
apk (aggressive)1813858.001814130.00+272.00 (+0.01%)
firebase-functionsapk (aggressive)393459.00393451.00-8.00 (-0.00%)
firebase-database-collectionapk (aggressive)313624.00313615.00-9.00 (-0.00%)
firebase-firestoreapk (aggressive)443195.00443174.00-21.00 (-0.00%)
baseapk (aggressive)10680.0010671.00-9.00 (-0.08%)
Metric Unit: byte

Test Logs

@vkryachko
Copy link
Member Author

/retest

Copy link
Contributor

@mrwillis21 mrwillis21 left a comment

Choose a reason for hiding this comment

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

Great improvements! 👍

@vkryachko
Copy link
Member Author

/retest

@google-oss-bot
Copy link
Contributor

Coverage Report

Affected SDKs

SDKTypeBase (4491f0a)Head (2518e80)Diff
Metric Unit: percentage

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage. Report files are located at <product-build-dir>/reports/jacoco/.

@vkryachko vkryachko merged commit ab8a693 into master Apr 3, 2020
@vkryachko vkryachko deleted the vk.transport_buffer branch April 21, 2020 15:28
@firebase firebase locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants