Source File
hashtable_pool.go
Belonging Package
github.com/klauspost/compress/s2
package s2import// Table size constantsconst (betterLongTableBits = 17betterLongTableSize = 1 << betterLongTableBits // 131072betterShortTableBits = 14betterShortTableSize = 1 << betterShortTableBits // 16384betterSnappyLongTableBits = 16betterSnappyLongTableSize = 1 << betterSnappyLongTableBits // 65536bestLongTableBits = 19bestLongTableSize = 1 << bestLongTableBits // 524288bestShortTableBits = 16bestShortTableSize = 1 << bestShortTableBits // 65536)type betterTables struct {lTable [betterLongTableSize]uint32sTable [betterShortTableSize]uint32}var betterTablePool = sync.Pool{New: func() any { return &betterTables{} }}// betterSnappyTables holds better-snappy compression hash tables.type betterSnappyTables struct {lTable [betterSnappyLongTableSize]uint32sTable [betterShortTableSize]uint32}var betterSnappyTablePool = sync.Pool{New: func() any { return &betterSnappyTables{} }}// bestTables holds best compression hash tables.type bestTables struct {lTable [bestLongTableSize]uint64sTable [bestShortTableSize]uint64}var bestTablePool = sync.Pool{New: func() any { return &bestTables{} }}// getBetterTables gets a zeroed betterTables from the pool.func getBetterTables() *betterTables {:= betterTablePool.Get().(*betterTables)* = betterTables{}return}// getBetterSnappyTables gets a zeroed betterSnappyTables from the pool.func getBetterSnappyTables() *betterSnappyTables {:= betterSnappyTablePool.Get().(*betterSnappyTables)* = betterSnappyTables{}return}// getBestTables gets a zeroed bestTables from the pool.func getBestTables() *bestTables {:= bestTablePool.Get().(*bestTables)* = bestTables{}return}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |