Skip to content

Commit

Permalink
chore: Update benchmark file and bench.sh to include lazy loading for…
Browse files Browse the repository at this point in the history
… images
  • Loading branch information
i5heu committed May 18, 2024
1 parent 2dba460 commit b3dd109
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,23 @@ You also need to have installed `benchstat` to compare the benchmarks, install i
goos: linux
goarch: arm64
pkg: github.com/i5heu/ouroboros-db
│ benchmarks/v0.0.5.txt │ benchmarks/v0.0.8.txt │ benchmarks/v0.0.14.txt │
│ benchmarks/v0.0.5.txt │ benchmarks/v0.0.8.txt │ benchmarks/v0.0.16.txt │
│ sec/op │ sec/op vs base │ sec/op vs base │
_setupDBWithData/RebuildIndex-8 640.7m ± 9% 648.5m ± 4% ~ (p=1.000 n=6) 653.4m ± 7% ~ (p=0.394 n=6)
_Index_RebuildingIndex/RebuildIndex-8 20.25m ± 16% 21.09m ± 12% ~ (p=0.310 n=6) 22.74m ± 10% ~ (p=0.093 n=6)
_Index_GetDirectChildrenOfEvent/GetChildrenOfEvent-8 4.953µ ± 5% 4.590µ ± 8% -7.33% (p=0.002 n=6) 4.832µ ± 3% ~ (p=0.240 n=6)
_Index_GetChildrenHashesOfEvent/GetChildrenHashesOfEvent-8 76.91n ± 2% 75.67n ± 5% ~ (p=0.699 n=6) 77.50n ± 3% ~ (p=0.394 n=6)
_DB_StoreFile/StoreFile-8 183.8µ ± 4% 185.2µ ± 3% ~ (p=0.589 n=6) 182.0µ ± 2% ~ (p=0.589 n=6)
_DB_GetFile/GetFile-8 3.639µ ± 4% 3.736µ ± 3% +2.68% (p=0.022 n=6) 3.652µ ± 2% ~ (p=0.558 n=6)
_DB_GetEvent/GetEvent-8 6.171µ ± 2% 6.201µ ± 2% ~ (p=0.394 n=6) 6.141µ ± 5% ~ (p=0.937 n=6)
_DB_GetMetadata/GetMetadata-8 4.021µ ± 3% 3.984µ ± 5% ~ (p=0.394 n=6) 3.827µ ± 5% -4.81% (p=0.009 n=6)
_DB_GetAllRootEvents/GetAllRootEvents-8 19.48m ± 3% 19.28m ± 2% ~ (p=0.485 n=6) 19.43m ± 5% ~ (p=0.699 n=6)
_DB_GetRootIndex/GetRootIndex-8 2.463m ± 2% 2.487m ± 2% ~ (p=0.240 n=6) 2.421m ± 7% ~ (p=0.699 n=6)
_DB_GetRootEventsWithTitle/GetRootEventsWithTitle-8 12.44µ ± 3% 12.48µ ± 3% ~ (p=0.818 n=6) 12.27µ ± 1% ~ (p=0.394 n=6)
_DB_CreateRootEvent/CreateRootEvent-8 130.8µ ± 4% 131.6µ ± 5% ~ (p=0.818 n=6) 130.9µ ± 3% ~ (p=0.818 n=6)
_DB_CreateNewEvent/CreateNewEvent-8 50.04µ ± 19% 50.55µ ± 16% ~ (p=0.937 n=6) 50.35µ ± 17% ~ (p=1.000 n=6)
geomean 109.4µ 109.4µ +0.06% 109.6µ +0.24%
_setupDBWithData/RebuildIndex-8 655.2m ± 4% 650.3m ± 2% ~ (p=0.699 n=6) 644.2m ± 3% ~ (p=0.699 n=6)
_Index_RebuildingIndex/RebuildIndex-8 20.71m ± 16% 20.97m ± 11% ~ (p=0.699 n=6) 20.88m ± 17% ~ (p=0.699 n=6)
_Index_GetDirectChildrenOfEvent/GetChildrenOfEvent-8 4.992µ ± 3% 4.944µ ± 4% ~ (p=0.485 n=6) 4.614µ ± 4% -7.58% (p=0.002 n=6)
_Index_GetChildrenHashesOfEvent/GetChildrenHashesOfEvent-8 77.94n ± 1% 77.63n ± 2% ~ (p=0.240 n=6) 77.28n ± 4% ~ (p=0.699 n=6)
_DB_StoreFile/StoreFile-8 184.8µ ± 3% 186.4µ ± 1% ~ (p=0.132 n=6) 184.7µ ± 3% ~ (p=0.818 n=6)
_DB_GetFile/GetFile-8 3.683µ ± 5% 3.631µ ± 5% ~ (p=0.368 n=6) 3.716µ ± 6% ~ (p=0.556 n=6)
_DB_GetEvent/GetEvent-8 6.271µ ± 2% 6.283µ ± 2% ~ (p=0.699 n=6) 6.173µ ± 5% ~ (p=0.589 n=6)
_DB_GetMetadata/GetMetadata-8 4.059µ ± 2% 4.078µ ± 5% ~ (p=1.000 n=6) 4.041µ ± 3% ~ (p=0.394 n=6)
_DB_GetAllRootEvents/GetAllRootEvents-8 19.74m ± 2% 19.24m ± 3% -2.52% (p=0.026 n=6) 19.89m ± 5% ~ (p=0.937 n=6)
_DB_GetRootIndex/GetRootIndex-8 2.464m ± 4% 2.497m ± 5% ~ (p=0.132 n=6) 2.474m ± 5% ~ (p=0.589 n=6)
_DB_GetRootEventsWithTitle/GetRootEventsWithTitle-8 12.26µ ± 3% 12.18µ ± 5% ~ (p=0.818 n=6) 12.26µ ± 4% ~ (p=0.937 n=6)
_DB_CreateRootEvent/CreateRootEvent-8 131.0µ ± 4% 130.7µ ± 3% ~ (p=0.485 n=6) 130.9µ ± 10% ~ (p=0.937 n=6)
_DB_CreateNewEvent/CreateNewEvent-8 50.87µ ± 16% 50.14µ ± 17% ~ (p=0.589 n=6) 49.52µ ± 18% ~ (p=0.937 n=6)
geomean 110.4µ 110.1µ -0.34% 109.4µ -0.95%

```

## OuroborosDB Performance Changelog
Expand Down
13 changes: 10 additions & 3 deletions ouroboros_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func Test_Index_RebuildIndex(t *testing.T) {

func Test_Index_GetDirectChildrenOfEvent(t *testing.T) {
ou, evs := setupDBWithData(t, setupDBConfig{
totalEvents: 100,
returnRandomEvents: 10,
totalEvents: 100,
returnAllEvents: true,
})

var childrenCount int // todo this is not a good test
Expand All @@ -169,6 +169,11 @@ func Test_Index_GetDirectChildrenOfEvent(t *testing.T) {
t.Errorf("GetDirectChildrenOfEvent failed with error: %v", err)
}
childrenCount += len(children)

}

if childrenCount == 0 {
t.Errorf("GetDirectChildrenOfEvent failed, expected non-zero count, got %d", childrenCount)
}
}

Expand Down Expand Up @@ -519,10 +524,12 @@ func Benchmark_Index_GetDirectChildrenOfEvent(b *testing.B) {

b.Run("GetChildrenOfEvent", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := ou.Index.GetDirectChildrenOfEvent(evs[rand.Intn(len(evs))])
ev, err := ou.Index.GetDirectChildrenOfEvent(evs[rand.Intn(len(evs))])
if err != nil {
b.Errorf("RebuildIndex failed with error: %v", err)
}

fmt.Println(len(ev))
}
})
}
Expand Down

0 comments on commit b3dd109

Please sign in to comment.