Skip to main content

wal_test.go

wal_test.go - Overview

This file contains benchmark tests for the AOF (Append-Only File) WAL (Write-Ahead Logging) implementation.

Detailed Documentation

Function: BenchmarkLogCommandAOF

Purpose: Benchmarks the performance of logging commands to the AOF WAL.

Parameters:

  • b (*testing.B): The benchmark object provided by the testing package.

Returns: None.

func BenchmarkLogCommandAOF(b *testing.B) {
wl, err := wal.NewAOFWAL("/tmp/dicedb-lt")
if err != nil {
panic(err)
}

if err := wl.Init(time.Now()); err != nil {
slog.Error("could not initialize WAL", slog.Any("error", err))
} else {
go wal.InitBG(wl)
}

for i := 0; i < b.N; i++ {
wl.LogCommand([]byte("SET key value"))
}
}

Getting Started Relevance