blob: 7e957448c6e0abf46acd5ef4f23c4b1ab3aad815 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package mobile
import "testing"
// BenchmarkDaysWeek (mobile_test.go) already covers the OF 7-day view this
// perf fix targets -- see internal/readings/offline.go's offlineLoad, which
// currently re-stacks the calendar layers and re-parses the book table once
// per day inside the loop Days drives. The benchmarks below add the two
// comparisons that let that fix's win be measured: the same view in the
// traditional form (a different, larger embedded calendar layer), and a
// single Day call, the per-day unit of work Days repeats.
// BenchmarkDays7EF is the 7-day view in the traditional (1962) form, whose
// calendar layer is a different embedded file (Tridentine vs Universal).
func BenchmarkDays7EF(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
Days("2026-07-27", 7, "ef", "pl")
}
}
// BenchmarkDay1 measures a single Day call, the unit of work Days repeats.
// Comparing this to BenchmarkDaysWeek/7 shows how much of each day's cost is
// the date-independent setup this fix hoists out.
func BenchmarkDay1(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
Day("2026-07-27", "of", "vul", "pl")
}
}
|