-
Notifications
You must be signed in to change notification settings - Fork 622
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
Memory allocations optimization #1695
Comments
Unfortunately, it seems that changing usage of |
True. Given the fact that serialization and deseralization as a whole are not implemented in the best memory efficient way whole thing could be rewritten to improve performance. |
@martin-sucha , does it mean I can proceed working on it? |
There are no concrete plans for v2 now. There are other things that require breaking changes and should be included in v2. Some of those other things are marked with the semver-major label as well. For example we should get rid of global logger, global batch, split host selection policies to separate packages and make them testable, etc. Remove support of old protocol versions, maybe add support for protocol v5 (if it requires breaking changes in the API, there may not be the need to tie it to v2). It would also help to change the Marshaller/Unmarshaller interfaces, there is currently no way to register custom unmarshaller for a CQL type protocol extension (#1675 (comment)). Releasing a v2 also means that the other packages in the ecosystem like scylladb/gocqlx will need to add support. Also there is https://github.com/scylladb/scylla-go-driver that I want to try out, so personally I can't promise anything regarding gocql v2 now. I am open to discussions though. If the community agrees on what the scope of what should be (and what shouldn't be) in v2 and who will implement all the changes required for v2, and how long v1 should be supported alongside v2, I guess I could help with releasing the changes. cc @jameshartig |
We're currrently working on a v2 release and this issue is labeled with |
I'd like to hear from other people in the community (maybe a DISCUSS thread on the mailing list) before putting this in scope for the v2 release. |
There are lots of peaces of code where reciever is concrete value:
As result when
NewWithError
is called golang recreate copy of reciever, i.e.CollectionType
struct.There is simple way to optimize it is to convert all of them to pointer reciever, which will make these allocations go away.
I have run test on that and here is results.
Before the fix (concrete receiver)
After the fix (pointer receiver)
As you can see size-wize memory allocations went from
504
to312
B/op and allocations went from13
to11
per op.Test code:
The text was updated successfully, but these errors were encountered: