MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / BenchmarkLargeWriteTx

Function BenchmarkLargeWriteTx

xenomint/sqlite/sqlite_test.go:700–734  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

698}
699
700func BenchmarkLargeWriteTx(b *testing.B) {
701 var (
702 st, _, _, e, src = setupBenchmarkStorage(b)
703
704 profiles = [...]int{0, 10, 100, 1000, 10000, 100000}
705 err error
706 )
707 for _, v := range profiles {
708 func() {
709 var tx = setupBenchmarkLargeWriteTx(b, st, e, src, v)
710 defer teardownBenchmarkLargeWriteTx(b, tx)
711
712 b.Run(fmt.Sprintf("%s#%d", b.Name(), v), func(b *testing.B) {
713 defer resetBenchmarkLargeWriteTx(b, tx)
714 for i := 0; i < b.N; i++ {
715 if _, err = tx.Exec(e, src[ipkg.next()]...); err != nil {
716 b.Errorf("Failed to execute: %v", err)
717 }
718 }
719 })
720 }()
721 }
722 // A simple commit duration testing, but not benchmark
723 for _, v := range profiles {
724 var (
725 tx = setupBenchmarkLargeWriteTx(b, st, e, src, v)
726 start = time.Now()
727 )
728 if err = tx.Commit(); err != nil {
729 b.Errorf("Failed to commit: %v", err)
730 }
731 b.Logf("Commit %d writes in %.3fms", v, float64(time.Since(start).Nanoseconds())/1000000)
732 }
733 teardownBenchmarkStorage(b, st)
734}
735
736//func BenchmarkStorageSequentialDirtyRead(b *testing.B) {
737// var (

Callers

nothing calls this directly

Calls 10

setupBenchmarkStorageFunction · 0.85
teardownBenchmarkStorageFunction · 0.85
NameMethod · 0.80
ErrorfMethod · 0.80
ExecMethod · 0.65
nextMethod · 0.65
CommitMethod · 0.65

Tested by

no test coverage detected