MCPcopy Create free account
hub / github.com/CPChain/chain / benchWriteChain

Function benchWriteChain

core/bench_test.go:238–252  ·  view source on GitHub ↗
(b *testing.B, full bool, count uint64)

Source from the content-addressed store, hash-verified

236}
237
238func benchWriteChain(b *testing.B, full bool, count uint64) {
239 for i := 0; i < b.N; i++ {
240 dir, err := ioutil.TempDir("", "eth-chain-bench")
241 if err != nil {
242 b.Fatalf("cannot create temporary directory: %v", err)
243 }
244 db, err := database.NewLDBDatabase(dir, 128, 1024)
245 if err != nil {
246 b.Fatalf("error opening database at %v: %v", dir, err)
247 }
248 makeChainForBench(db, full, count)
249 db.Close()
250 os.RemoveAll(dir)
251 }
252}
253
254func benchReadChain(b *testing.B, full bool, count uint64) {
255 testdb := database.NewMemDatabase()

Calls 2

CloseMethod · 0.95
makeChainForBenchFunction · 0.85

Tested by

no test coverage detected