- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.7 KiB
Semantic Overview of obiseq Package Functionalities
This Go package (obiseq) provides memory-efficient utilities for managing slices and annotations—key data structures in biosequence processing.
Slice Management
-
GetSlice(capacity int) []byte
Retrieves a reusable[]bytewith ≥ requested capacity. For capacities ≤1024 bytes, it pulls from async.Pool(_BioSequenceByteSlicePool). Larger slices are freshly allocated. -
RecycleSlice(s *[]byte)
Clears and recycles small slices (≤1024 bytes) back to the pool. For large slices (≥100 KB), it nils them and triggers explicitruntime.GC()every ~256 MB of discarded memory to prevent heap bloat. -
CopySlice(src []byte) []byte
Efficiently copies a source slice into a pooled or newly allocated destination, preserving semantics without unnecessary allocations.
Annotation Management
-
BioSequenceAnnotationPool
Async.Poolfor reusable map-based annotations (map[string]string, inferred from usage), initialized with capacity 1. -
GetAnnotation(values ...Annotation) Annotation
Fetches an annotation map from the pool, optionally pre-populated via shallow copy of input annotations usingobiutils.MustFillMap. -
RecycleAnnotation(a *Annotation)
Clears all keys from an annotation map and returns it to the pool for reuse.
Design Rationale
The package prioritizes low-latency, high-throughput scenarios (e.g., NGS data pipelines) by minimizing GC pressure via:
- Tiered pooling strategy (
smallvslarge) - Explicit garbage collection triggers for large-object churn
- Safe reuse patterns avoiding aliasing or stale references
All operations are thread-safe via sync.Pool and atomic counters.