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

Improved performance of Pipeline.exec #991

Merged
merged 2 commits into from Nov 22, 2019
Merged

Improved performance of Pipeline.exec #991

merged 2 commits into from Nov 22, 2019

Conversation

flunderpero
Copy link
Contributor

Execution cost of Pipeline.exec can be reduced to 50% or lower. This is
accomplished by first filling up an Array of Buffers and then calling Buffer.concat
instead of calling Buffer.concat for each command.
In our use-case (~3000 commands in a single Pipeline) wall-clock-runtime went
down from 1.3sec to 500ms.

if (!buffers) {
buffers = [];
}
if (typeof data === "string") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Data is ignored if its already a buffer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

data cannot be a Buffer. I cleaned up the code a bit to make this clear.
Your comment made me aware that buffers is actually never re-set, so I did that, too.

@tuananh
Copy link
Contributor

tuananh commented Oct 29, 2019

can you take a look at this @luin / @AVVS ?

@AVVS
Copy link
Collaborator

AVVS commented Oct 30, 2019

LGTM, @luin if you are ok with the PR I'd be happy to merge :)

@AVVS
Copy link
Collaborator

AVVS commented Nov 22, 2019

I'll merge this in, I believe releases are going through /next tag and it should be safe

@AVVS AVVS merged commit 86470a8 into redis:master Nov 22, 2019
ioredis-robot pushed a commit that referenced this pull request Nov 22, 2019
## [4.14.4](v4.14.3...v4.14.4) (2019-11-22)

### Bug Fixes

* improved performance of Pipeline.exec ([#991](#991)) ([86470a8](86470a8))
@ioredis-robot
Copy link
Collaborator

🎉 This PR is included in version 4.14.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@luin
Copy link
Collaborator

luin commented Nov 22, 2019

I'll merge this in, I believe releases are going through /next tag and it should be safe

Thank you for merging this! I totally missed this pull request. The code LGTM.

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.

None yet

5 participants