]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Optimize padding on Piece
authorMatt Joiner <anacrolix@gmail.com>
Tue, 29 Sep 2020 06:37:58 +0000 (16:37 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 29 Sep 2020 06:37:58 +0000 (16:37 +1000)
piece.go
piece_test.go

index fd0eb68a56e04148b64ce4af8bb8028bd0042c3a..2e6a4259a109b7579ad37370c71bccebf6e7d6cc 100644 (file)
--- a/piece.go
+++ b/piece.go
@@ -48,8 +48,8 @@ type Piece struct {
        // length can be determined by the request chunkSize in use.
        _dirtyChunks bitmap.Bitmap
 
-       hashing             bool
        numVerifies         int64
+       hashing             bool
        storageCompletionOk bool
 
        publicPieceState PieceState
index 1843f95daa70ab7240479655df5827d8e3bd731f..1e030b5209f18bd74b0031d5bf62c5ce2024790b 100644 (file)
@@ -6,5 +6,7 @@ import (
 )
 
 func TestPieceSize(t *testing.T) {
-       t.Logf("%v", unsafe.Sizeof(Piece{}))
+       t.Log("[]*File", unsafe.Sizeof([]*File(nil)))
+       t.Log("Piece", unsafe.Sizeof(Piece{}))
+       t.Log("map[*peer]struct{}", unsafe.Sizeof(map[*peer]struct{}(nil)))
 }