Skip to content

Conversation

@nilanshu-sharma
Copy link
Collaborator

@nilanshu-sharma nilanshu-sharma commented Dec 4, 2025

Adding custom responses for lpop an rpop commands which return:

  • nil if key doesn't exist
  • ByteBuffer? if invoked without count param
  • [ByteBuffer]? if invoked with count

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

✅ Pull request no significant performance differences ✅

Summary

New baseline 'pull_request' is WITHIN the 'main' baseline thresholds.

Full Benchmark Comparison

Comparing results between 'main' and 'pull_request'

Host '939bbd0fa115' with 4 'x86_64' processors with 15 GB memory, running:
#18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025

ValkeyBenchmarks

Client: GET benchmark metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 76 78 78 79 79 79 79 6
pull_request 71 79 80 81 81 81 81 6
Δ -5 1 2 2 2 2 2 0
Improvement % 7 -1 -3 -3 -3 -3 -3 0

Client: GET benchmark | parallel 20 | 20 concurrent connections metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 73 77 81 83 87 89 89 28
pull_request 73 77 79 83 86 87 87 28
Δ 0 0 -2 0 -1 -2 -2 0
Improvement % 0 0 2 0 1 2 2 0

Connection: GET benchmark metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 4 4 4 4 4 4 4 8
pull_request 4 4 4 4 4 4 4 8
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

Connection: GET benchmark – NoOpTracer metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 7 8 8 10 11 11 11 8
pull_request 7 8 8 10 11 11 11 8
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

Connection: Pipeline array benchmark metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 33 33 33 34 34 34 34 6
pull_request 33 33 34 34 34 34 34 6
Δ 0 0 1 0 0 0 0 0
Improvement % 0 0 -3 0 0 0 0 0

Connection: Pipeline benchmark metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 33 33 33 34 34 34 34 6
pull_request 33 33 33 34 34 34 34 5
Δ 0 0 0 0 0 0 0 -1
Improvement % 0 0 0 0 0 0 0 -1

HashSlot – {user}.whatever metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 0 0 0 0 0 0 0 18
pull_request 0 0 0 0 0 0 0 18
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

ValkeyCommandEncoder – Command with 7 words metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 0 0 0 0 0 0 0 731
pull_request 0 0 0 0 0 0 0 713
Δ 0 0 0 0 0 0 0 -18
Improvement % 0 0 0 0 0 0 0 -18

ValkeyCommandEncoder – Simple GET metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 0 0 0 0 0 0 0 1879
pull_request 0 0 0 0 0 0 0 1807
Δ 0 0 0 0 0 0 0 -72
Improvement % 0 0 0 0 0 0 0 -72

ValkeyCommandEncoder – Simple MGET 15 keys metrics

Malloc (total): results within specified thresholds, fold down for details.

Malloc (total) * p0 p25 p50 p75 p90 p99 p100 Samples
main 0 0 0 0 0 0 0 357
pull_request 0 0 0 0 0 0 0 339
Δ 0 0 0 0 0 0 0 -18
Improvement % 0 0 0 0 0 0 0 -18

@nilanshu-sharma nilanshu-sharma requested review from adam-fowler and yang-z-o and removed request for adam-fowler December 5, 2025 00:42
Nilanshu Sharma added 7 commits December 5, 2025 10:32
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
Signed-off-by: Nilanshu Sharma <[email protected]>
@nilanshu-sharma nilanshu-sharma force-pushed the custom-responses-list-commands branch from 928f5a6 to 528fde1 Compare December 5, 2025 19:21
Copy link
Collaborator

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

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

Some additional comments.

This PR does make me wonder about the sense of creating responses for every command instead of allowing some just to return a RESPToken. Note the amount of extra code you needed to add in the CommandTests test

/// - Returns: ByteBuffer if a single element was returned, nil otherwise
public func element() throws -> ByteBuffer? {
// Handle .null as it is expected when the key doesn't exist
if token.value == .null {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Checking for null here shouldn't be needed, that has already been done because the LPOP/RPOP response is optional. Which means the function can return a non-optional value. It should be RESPBulkString instead of ByteBuffer

/// Gets the multiple elements when count was provided
/// - Returns: Array of ByteBuffer if multiple elements were returned, nil otherwise
public func elements() throws -> [ByteBuffer]? {
try [ByteBuffer]?(token)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't need to be optional

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