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

Optimisation computeDigest() in key.go? #1

Closed
csimplestring opened this issue Aug 13, 2014 · 2 comments
Closed

Optimisation computeDigest() in key.go? #1

csimplestring opened this issue Aug 13, 2014 · 2 comments

Comments

@csimplestring
Copy link

I notice that the key.go: every time computing a digest for a key, it has to allocate a new slice. This will stress GC. In aerospike java client source code, I notice that thread-local buffer technique is used to improve this. But in Golang, there is no equivalent technique. I think why not to use a singleton buffer to hold data when computing key digest, instead of allocating a new slice many times?

@khaf
Copy link
Collaborator

khaf commented Aug 13, 2014

Thank you for your suggestion. A simple singleton buffer cannot be used in concurrent applications. We can use a queue to cache many buffers, but then we will have to pay the cost of synchronization (and memory to keep all those buffers around indefinitely).

I still agree that this part of code is a hot spot and should be further optimized, and a variation of your suggestion could potentially reduce the load on GC.

Please note that the client code is not micro-optimized yet. We'll begin to work on optimizations and micro-benchmarking after we have released all the planned functionality. This being said, it still performs reasonably well compared to Java client.

We welcome any suggestions to make the client better and easier to work with.

@khaf
Copy link
Collaborator

khaf commented Aug 21, 2014

As of beta release, Hash objects are pooled now. There's also no heap allocations anymore..

@khaf khaf closed this as completed Aug 28, 2014
khaf added a commit that referenced this issue May 15, 2015
Introducing .build.yml, for the new build system
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

No branches or pull requests

2 participants