MCPcopy
hub / github.com/redis/go-redis / BenchmarkHSETPipelined_RESP2

Function BenchmarkHSETPipelined_RESP2

hset_benchmark_test.go:327–356  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

325}
326
327func BenchmarkHSETPipelined_RESP2(b *testing.B) {
328 ctx := context.Background()
329
330 // Setup Redis client
331 rdb := redis.NewClient(&redis.Options{
332 Addr: "localhost:6379",
333 Password: "", // no password docs
334 DB: 0, // use default DB
335 Protocol: 2,
336 })
337 defer rdb.Close()
338
339 // Test connection
340 if err := rdb.Ping(ctx).Err(); err != nil {
341 b.Skipf("Redis server not available: %v", err)
342 }
343
344 // Clean up before and after tests
345 defer func() {
346 rdb.FlushDB(ctx)
347 }()
348
349 scales := []int{1, 10, 100, 1000, 10000, 100000}
350
351 for _, scale := range scales {
352 b.Run(fmt.Sprintf("HSET_Pipelined_RESP2_%d_operations", scale), func(b *testing.B) {
353 benchmarkHSETPipelined(b, rdb, ctx, scale)
354 })
355 }
356}

Callers

nothing calls this directly

Calls 6

benchmarkHSETPipelinedFunction · 0.85
CloseMethod · 0.65
ErrMethod · 0.65
PingMethod · 0.65
FlushDBMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected