Skip to content

Small improvements to payload generation - #1063

Merged
arthurschreiber merged 6 commits into
masterfrom
arthur/payload-improvements
Mar 5, 2020
Merged

arthurschreiber merged 6 commits into
masterfrom
arthur/payload-improvements

Conversation

@arthurschreiber

Copy link
Copy Markdown
Collaborator

This contains a few small improvements to the payload generation code that should slightly improve performance.

Comment thread src/rpcrequest-payload.ts

* generateParameterData(parameter: Parameter, options: any) {
const buffer = new WritableTrackingBuffer(0);
const buffer = new WritableTrackingBuffer(1 + 2 + Buffer.byteLength(parameter.name, 'ucs-2') + 1);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This ensures the Buffer used by WritableTrackingBuffer is big enough to contain the data that will be written to it without causing any resizing,

@arthurschreiber

Copy link
Copy Markdown
Collaborator Author

CI build for Node.js 13.x is currently failing because of an incompatibility with one of the babel related packages. #1064 will fix this.

@codecov

codecov Bot commented Mar 4, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1063 into master will increase coverage by 0.47%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1063      +/-   ##
==========================================
+ Coverage   80.16%   80.63%   +0.47%     
==========================================
  Files          86       86              
  Lines        4366     4374       +8     
  Branches      785      789       +4     
==========================================
+ Hits         3500     3527      +27     
+ Misses        614      587      -27     
- Partials      252      260       +8     
Impacted Files Coverage Δ
src/tracking-buffer/writable-tracking-buffer.ts 71.81% <0.00%> (-8.06%) ⬇️
src/incoming-message-stream.ts 92.30% <0.00%> (-5.13%) ⬇️
src/connection.ts 63.98% <0.00%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d6cff9...de5583e. Read the comment docs.

arthurschreiber and others added 2 commits March 5, 2020 07:20
As the payload data is generated via a generator function, the buffering behavior for streams with `objectMode: false` does not seem to have any benefit.
@arthurschreiber
arthurschreiber merged commit 16b9cc9 into master Mar 5, 2020
@arthurschreiber
arthurschreiber deleted the arthur/payload-improvements branch March 5, 2020 08:58
@arthurschreiber

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 8.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants