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

Store ReadOnly commands and query these as bitmask #457

Closed
mp911de opened this issue Jan 29, 2017 · 1 comment
Closed

Store ReadOnly commands and query these as bitmask #457

mp911de opened this issue Jan 29, 2017 · 1 comment
Labels
type: feature A new feature
Milestone

Comments

@mp911de
Copy link
Collaborator

mp911de commented Jan 29, 2017

Redis Cluster and Master/Slave store ReadOnly commands as array and Intent resolution iterates through the array. Using a bitmask reduces computational intensity to arithmetic operations.

Current intent resolution for all known commands:

# Warmup Iteration   1: 2282,007 ns/op
# Warmup Iteration   2: 2441,771 ns/op
# Warmup Iteration   3: 2240,678 ns/op
# Warmup Iteration   4: 2345,982 ns/op
# Warmup Iteration   5: 2312,569 ns/op
Iteration   1: 2296,601 ns/op
Iteration   2: 2284,608 ns/op
Iteration   3: 2338,286 ns/op
Iteration   4: 2351,286 ns/op
Iteration   5: 2304,565 ns/op

Optimized approach

# Warmup Iteration   1: 194,052 ns/op
# Warmup Iteration   2: 177,044 ns/op
# Warmup Iteration   3: 174,675 ns/op
# Warmup Iteration   4: 174,695 ns/op
# Warmup Iteration   5: 173,879 ns/op
Iteration   1: 173,907 ns/op
Iteration   2: 172,596 ns/op
Iteration   3: 171,966 ns/op
Iteration   4: 175,460 ns/op
Iteration   5: 180,235 ns/op
@mp911de
Copy link
Collaborator Author

mp911de commented Jan 30, 2017

Well, use EnumSet.

Enum sets are represented internally as bit vectors.

@mp911de mp911de added this to the Lettuce 4.3.1 milestone Jan 30, 2017
@mp911de mp911de added the type: feature A new feature label Jan 30, 2017
mp911de added a commit that referenced this issue Jan 30, 2017
Use EnumSet that stores enum values as bit vector instead of iterating through an array of elements.
mp911de added a commit that referenced this issue Jan 30, 2017
Use EnumSet that stores enum values as bit vector instead of iterating through an array of elements.
mp911de added a commit that referenced this issue Jan 30, 2017
Use EnumSet that stores enum values as bit vector instead of iterating through an array of elements.
@mp911de mp911de closed this as completed Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new feature
Projects
None yet
Development

No branches or pull requests

1 participant