MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / BenchmarkFileHeader_Compact

Function BenchmarkFileHeader_Compact

internal/utils/bfs/file_header_test.go:375–395  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

373}
374
375func BenchmarkFileHeader_Compact(b *testing.B) {
376 for i := 0; i < b.N; i++ {
377 var header = &bfs.FileHeader{
378 Version: 1,
379 Status: 200,
380 BodySize: 200,
381 BodyBlocks: nil,
382 }
383
384 for j := 0; j < 100; j++ {
385 header.BodyBlocks = append(header.BodyBlocks, bfs.BlockInfo{
386 OriginOffsetFrom: int64(j * 100),
387 OriginOffsetTo: int64(j * 200),
388 BFileOffsetFrom: 0,
389 BFileOffsetTo: 0,
390 })
391 }
392
393 header.Compact()
394 }
395}
396
397func BenchmarkFileHeader_Encode(b *testing.B) {
398 runtime.GOMAXPROCS(12)

Callers

nothing calls this directly

Calls 1

CompactMethod · 0.45

Tested by

no test coverage detected