From 27d39f6ad497d473790090aaf9e068e5e3917527 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Tue, 1 Jul 2025 23:53:19 -0400 Subject: [PATCH] fix: minor edits and fixes --- README.md | 14 +++++++------- lock_free_queue.go | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 936de96..0bf3cce 100644 --- a/README.md +++ b/README.md @@ -304,13 +304,13 @@ make bench ### Benchmark Results -| Benchmark | Iterations | ns/op | B/op | allocs/op | -|--------------------------------------------------|------------|------:|-----:|----------:| -| [LockFreeQ](lock_free_queue_benchmark_test.go) | 24752019 | 79.73 | 16 | 1 | -| [NewLockFreeQ](lock_free_queue_benchmark_test.go) | 1000000000 | 0.29 | 0 | 0 | -| [LockFreeQ_Enqueue](lock_free_queue_benchmark_test.go) | 25041442 | 49.18 | 16 | 1 | -| [LockFreeQ_Dequeue](lock_free_queue_benchmark_test.go) | 338000521 | 11.14 | 0 | 0 | -| [LockFreeQ_IsEmpty](lock_free_queue_benchmark_test.go) | 1000000000 | 0.60 | 0 | 0 | +| Benchmark | Iterations | ns/op | B/op | allocs/op | +|-------------------------------------------------------|------------|------:|-----:|----------:| +| [LockFreeQueue](lock_free_queue_benchmark_test.go) | 24752019 | 79.73 | 16 | 1 | +| [NewLockFreeQ](lock_free_queue_benchmark_test.go) | 1000000000 | 0.29 | 0 | 0 | +| [LockFreeQEnqueue](lock_free_queue_benchmark_test.go) | 25041442 | 49.18 | 16 | 1 | +| [LockFreeQDequeue](lock_free_queue_benchmark_test.go) | 338000521 | 11.14 | 0 | 0 | +| [LockFreeQIsEmpty](lock_free_queue_benchmark_test.go) | 1000000000 | 0.60 | 0 | 0 | > These benchmarks reflect fast, allocation-free lookups for most retrieval functions, ensuring optimal performance in production environments. > Performance benchmarks for the core functions in this library, executed on a 13th Gen Intel i7-1360P (AMD64). diff --git a/lock_free_queue.go b/lock_free_queue.go index ef7848e..2942fad 100644 --- a/lock_free_queue.go +++ b/lock_free_queue.go @@ -6,6 +6,7 @@ import ( "sync/atomic" ) +// node represents a single element in the lock-free queue. type node[T any] struct { value T next atomic.Pointer[node[T]]