-
Notifications
You must be signed in to change notification settings - Fork 40
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
Avoid easy allocations #62
Avoid easy allocations #62
Conversation
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
==========================================
+ Coverage 93.91% 94.73% +0.82%
==========================================
Files 98 140 +42
Lines 7375 8602 +1227
==========================================
+ Hits 6926 8149 +1223
- Misses 449 453 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Are you planning to do more changes or is this PR ready to be merged from your perspective?
Unfortunately, I did not see this PR before I tagged and released v2.6.0 just now. So these changes will have to wait for the next release.
@@ -25,6 +26,8 @@ module Aerospike | |||
private | |||
|
|||
class ReadCommand < SingleCommand #:nodoc: | |||
VALUE_ENCODING = 'utf-8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe BIN_NAME_ENCODING
would be a better name?
@@ -314,7 +314,7 @@ def get_header(key, options={}) | |||
# The returned records are in positional order with the original key array order. | |||
# If a key is not found, the positional record will be nil. | |||
# The policy can be used to specify timeouts. | |||
def batch_get(keys, bin_names=[], options={}) | |||
def batch_get(keys, bin_names = nil, options = nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the default value for bin_names
from []
to nil
could potentially break an application that calls Client#batch_get
without passing bin_names
since we call bin_names.uniq
further down when creating the BatchCommandGet
instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that (and apparently specs did too). Imho uniq
is not necessary here, and protecting from duplicate bins seems a bit overkill. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's remove the uniq
call. Not sure why it was added in the first place. None of the other commands that take a list of bin names as parameter do that, I think.
I'm afraid the specs don't cover a lot of the edge cases so I'm not surprised they didn't catch this.
@jhecking no more work planned on this for now. Since it's minor, I don't see a reason for making a separate release with this, it can just be released whenever the next one coming (eg. the new node removal strategy) |
Cool. Will merge once you do the fix for batch_get method. |
Done! |
Micro-optimizations. Not a huge performance improvement but low hanging fruits for getting rid of allocations during common operations
These are avoided when running 10k put + 10k get