You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// (The 'benchdraw' command alluded to here is https://github.com/cep21/benchdraw .)
97
+
98
+
// Histograms of blocksizes can be logged from some of the following functions, but are commented out.
99
+
// The main thing to check for in those is whether there are any exceptionally small blocks being produced:
100
+
// less than 64 bytes is a bit concerning because we assume there's some overhead per block in most operations (even if the exact amount may vary situationally).
101
+
// We do see some of these small blocks with small bitwidth parameters (e.g. 3), but almost none with larger bitwidth parameters.
102
+
103
+
// BenchmarkFill creates a large HAMT, and measures how long it takes to generate all of this many entries;
104
+
// the number of entries is varied in sub-benchmarks, denoted by their "n=" label component.
105
+
// Flush is done once for the entire structure, meaning the number of blocks generated per entry can be much fewer than 1.
106
+
//
107
+
// The number of blocks saved to the blockstore per entry is reported, and the total content size in bytes.
108
+
// The nanoseconds-per-op report on this function is not very useful, because the size of "op" varies with "n" between benchmarks.
109
+
//
110
+
// See "BenchmarkSet*" for a probe of how long it takes to set additional entries in an already-large hamt
111
+
// (this gives a more interesting and useful nanoseconds-per-op indicators).
b.Logf("on round N=%d: blockstore stats: %#v\n", b.N, blockstore.stats) // note: must refer to this before doing `n.checkSize`; that function has many effects.
// BenchmarkSetBulk creates a large HAMT, then resets the timer, and does another 1000 inserts,
148
+
// measuring the time taken for this second batch of inserts.
149
+
// Flushing happens once after all 1000 inserts.
150
+
//
151
+
// The number of *additional* blocks per entry is reported.
152
+
// This number is usually less than one, because the bulk flush means changes might be amortized.
153
+
funcBenchmarkSetBulk(b*testing.B) {
154
+
doBenchmarkSetSuite(b, false)
155
+
}
156
+
157
+
// BenchmarkSetIndividual is the same as BenchmarkSetBulk, but flushes more.
158
+
// Flush happens per insert.
159
+
//
160
+
// The number of *additional* blocks per entry is reported.
161
+
// Since we flush each insert individually, this number should be at least 1 --
162
+
// however, since we choose random keys, it can still turn out lower if keys happen to collide.
163
+
// (The Set method does not make it possible to adjust our denominator to compensate for this: it does not yield previous values nor indicators of prior presense.)
0 commit comments