MCPcopy
hub / github.com/google/mangle / BenchmarkTemporalStore_GetFactsDuring

Function BenchmarkTemporalStore_GetFactsDuring

engine/temporal_test.go:592–618  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

590}
591
592func BenchmarkTemporalStore_GetFactsDuring(b *testing.B) {
593 store := factstore.NewTemporalStore()
594
595 // Add many facts
596 for i := 0; i < 10000; i++ {
597 atomName, _ := ast.Name("/item" + string(rune('0'+i%100)))
598 store.Add(ast.NewAtom("available", atomName), ast.TimeInterval(
599 time.Date(2024, 1, 1+i%28, 0, 0, 0, 0, time.UTC),
600 time.Date(2024, 2, 1+i%28, 0, 0, 0, 0, time.UTC),
601 ))
602 }
603
604 query := ast.NewAtom("available", ast.Variable{Symbol: "X"})
605 interval := ast.TimeInterval(
606 ast.Date(2024, 1, 10),
607 ast.Date(2024, 1, 20),
608 )
609
610 b.ResetTimer()
611 for i := 0; i < b.N; i++ {
612 count := 0
613 store.GetFactsDuring(query, interval, func(tf factstore.TemporalFact) error {
614 count++
615 return nil
616 })
617 }
618}
619
620func BenchmarkIntervalCoalesce(b *testing.B) {
621 for i := 0; i < b.N; i++ {

Callers

nothing calls this directly

Calls 7

AddMethod · 0.95
GetFactsDuringMethod · 0.95
NewTemporalStoreFunction · 0.92
NameFunction · 0.92
NewAtomFunction · 0.92
TimeIntervalFunction · 0.92
DateFunction · 0.92

Tested by

no test coverage detected