Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **Zero-Allocation Operations**: Stack-based buffers for typical use cases (hashCount ≤ 16, covering 99% of scenarios)
- **Comprehensive Benchmarks**: Comparison vs willf/bloom and Thread-Safe Pool implementations
- 3-4x faster than willf/bloom
- 15-26x faster than Thread-Safe Pool
- Complete benchmark suite in separate repository

### Changed

- **BREAKING**: Simplified implementation with atomic operations (removed sync.Pool complexity)
- Removed `AddBatch`, `AddBatchString`, `AddBatchUint64` functions
- Removed `IsArrayMode()` method (no longer has hybrid storage modes)
- Removed `internal/storage` package (simplified to direct cache-line array)
- **Architecture Simplification**: ~400 lines vs ~605 lines (34% reduction)
- Direct cache-line array storage (no map/array mode switching)
- Stack buffer for hash positions (zero allocations for hashCount ≤ 16)
- Simple atomic CAS loops instead of complex pooling logic
- **Performance Improvements**: Lock-free atomic operations
- 26 ns/op for Add (vs 400 ns/op with pool)
- 23 ns/op for Contains (vs 600 ns/op with pool)
- 20 ns/op for AddUint64 (fastest operation)
- Zero allocations on all hot paths

### Removed

- **Batch Operations**: Removed for simplicity (individual operations are now fast enough)
- **Storage Package**: Removed hybrid array/map storage complexity
- **sync.Pool**: Removed pooling overhead and complexity
- **IsArrayMode()**: No longer relevant with simplified architecture

### Performance

- **Throughput**: 18.6M insertions/sec, 35.8M lookups/sec (1M elements, 0.01 FPR)
- **Allocations**: Zero allocations on hot path (Add, Contains, AddUint64)
- **Memory**: 99.93% less allocations than Thread-Safe Pool version
- **SIMD**: 2-4x faster for bulk operations (Union, Intersection, PopCount)
- **Thread-Safe**: Built-in lock-free atomic operations (no external locks required)

### Fixed

- Eliminated all pool-related bugs and complexity
- No escape analysis issues (stack buffers for typical cases)
- Predictable performance (no pool warmup needed)
- Simpler codebase (easier to maintain and audit)

## [0.3.0] - Thread-Safe Pool Version (Previous)

### Added

- **Thread-Safety**: Full concurrent support with lock-free atomic operations
- Lock-free bit operations using atomic Compare-And-Swap (CAS)
- Bounded retry limits with exponential backoff under contention
Expand Down
232 changes: 0 additions & 232 deletions FOLDER_ORGANIZATION.md

This file was deleted.

40 changes: 32 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ help:
@echo " dist - Create distribution packages"
@echo " release - Create release artifacts"
@echo " test - Run all tests"
@echo " test-short - Run quick tests (skip long-running)"
@echo " test-race - Run tests with race detector"
@echo " test-integration - Run integration tests only"
@echo " test-pure - Run tests with pure Go (no SIMD)"
@echo " bench - Run benchmarks"
@echo " bench-short - Run quick benchmarks"
@echo " bench-all - Run benchmarks for both SIMD and pure Go"
@echo " fmt - Format all Go code"
@echo " lint - Run linter"
Expand Down Expand Up @@ -96,36 +100,56 @@ dist-dir:
# Test targets
.PHONY: test
test:
@echo "Running tests with SIMD optimizations..."
cd $(PACKAGE_PATH) && $(GO) test -v -race .
@echo "Running all tests..."
cd $(PACKAGE_PATH) && $(GO) test -v ./...

.PHONY: test-short
test-short:
@echo "Running quick tests (skip long-running tests)..."
cd $(PACKAGE_PATH) && $(GO) test -v -short ./...

.PHONY: test-race
test-race:
@echo "Running tests with race detector..."
cd $(PACKAGE_PATH) && $(GO) test -race -v ./...

.PHONY: test-integration
test-integration:
@echo "Running integration tests..."
cd $(PACKAGE_PATH) && $(GO) test -v ./tests/integration/...

.PHONY: test-pure
test-pure:
@echo "Running tests with pure Go (no SIMD)..."
cd $(PACKAGE_PATH) && $(GO) test -v -race -tags purego .
cd $(PACKAGE_PATH) && $(GO) test -v -tags purego ./...

.PHONY: test-all
test-all: test test-pure
test-all: test test-race test-pure

# Benchmark targets
.PHONY: bench
bench:
@echo "Running benchmarks with SIMD optimizations..."
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem .
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem ./tests/benchmark/...

.PHONY: bench-short
bench-short:
@echo "Running quick benchmarks..."
cd $(PACKAGE_PATH) && $(GO) test -bench=. -benchmem -benchtime=1s ./tests/benchmark/...

.PHONY: bench-pure
bench-pure:
@echo "Running benchmarks with pure Go (no SIMD)..."
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem -tags purego .
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem -tags purego ./tests/benchmark/...

.PHONY: bench-all
bench-all:
@echo "Running benchmarks comparison..."
@echo "=== SIMD Optimized ==="
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem .
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem ./tests/benchmark/...
@echo ""
@echo "=== Pure Go ==="
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem -tags purego .
cd $(PACKAGE_PATH) && $(GOBENCH) -benchmem -tags purego ./tests/benchmark/...

.PHONY: bench-compare
bench-compare:
Expand Down
Loading
Loading