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

A lot of memory allocation optimizations #466

Merged
merged 4 commits into from
Jul 17, 2020
Merged

A lot of memory allocation optimizations #466

merged 4 commits into from
Jul 17, 2020

Conversation

atercattus
Copy link
Member

@atercattus atercattus commented Jan 29, 2020

Zero-allocation in hot paths for mysql/client.
!! Changed Resultset.Values public API !!

This package is very fond of temporarily memory allocation. I like this package, but its gc pressure isn't acceptable for me. So I did a number of small (I have tried) changes in code base for removing that allocations.
I don't sure it's acceptable for you, but I considered it my duty to send PR :)

Before changes:
image

After changes:
image

Typical usage:

r, err := conn.Execute(sql)
//... Working with r
r.Close() // New call for memory reusing

… for mysql/client. Changed Resultset.Values public API.
@siddontang
Copy link
Collaborator

Sorry for the late response @atercattus

I am very busy these days, I will review your PR ASAP.

mysql/field.go Outdated Show resolved Hide resolved
Copy link

@bobotu bobotu left a comment

Choose a reason for hiding this comment

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

LGTM

@atercattus atercattus changed the title A lot of memory allocation optimization A lot of memory allocation optimizations Jul 16, 2020
@atercattus atercattus merged commit 699f269 into go-mysql-org:master Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants