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

fix bytebuffer copy #232

Merged
merged 2 commits into from Apr 2, 2019

Conversation

2 participants
@tanner0101
Copy link
Member

tanner0101 commented Apr 2, 2019

This PR fixes an unnecessary byte buffer copy that was triggered by using set() in a function for reading packet length. The set is not necessary since we can clear the upper bits more efficiently using &.

@tanner0101 tanner0101 added the bug label Apr 2, 2019

@tanner0101 tanner0101 added this to In Progress in Vapor 3 via automation Apr 2, 2019

@tanner0101

This comment has been minimized.

Copy link
Member Author

tanner0101 commented Apr 2, 2019

Here are results comparing current 3 branch and this PR. The test consists of 20 requests for a route in a Vapor project using Fluent that pulls 10,000 rows from a MySQL DB

macOS

On macOS, this change reduces peak memory usage by ~10x.

Before

Screen Shot 2019-04-02 at 9 25 12 AM

After

Screen Shot 2019-04-02 at 9 23 08 AM

Linux

On Linux, overall memory usage is reduced a bit more at ~15x.

Before

Screenshot from 2019-04-02 09-40-01

After

Screenshot from 2019-04-02 09-42-05

@tanner0101 tanner0101 merged commit d1561ae into 3 Apr 2, 2019

7 checks passed

ci/circleci: 5.5-linux Your tests passed on CircleCI!
Details
ci/circleci: 5.6-linux Your tests passed on CircleCI!
Details
ci/circleci: 5.7-linux Your tests passed on CircleCI!
Details
ci/circleci: 8.0-linux Your tests passed on CircleCI!
Details
ci/circleci: 8.0-linux-fluent Your tests passed on CircleCI!
Details
ci/circleci: linux-release Your tests passed on CircleCI!
Details
ci/circleci: mariadb-10.3-linux Your tests passed on CircleCI!
Details
@penny-coin

This comment has been minimized.

Copy link

penny-coin commented Apr 2, 2019

Hey @tanner0101, you just merged a pull request, have a coin!

You now have 1175 coins.

@tanner0101 tanner0101 deleted the packet-length-copy branch Apr 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.