INNER CODE UNIT · Go

BenchmarkBsonUnmarshal

simagix/hatchet · benchmark_test.go:26

func BenchmarkBsonUnmarshal(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		doc := Logv2Info{}
		bson.UnmarshalExtJSON([]byte(benchmarkLogStr), false, &doc)
	}
}

// BenchmarkBsonD2M benchmarks the optimized BsonD2M conversion
func BenchmarkBsonD2M(b *testing.B) {
	// Create a sample bson.D
	d := bson.D{
		{"first", "Ken"},
		{"last", "Chen"},
		{"nested", bson.D{{"a", 1}, {"b", 2}}},
		{"array", bson.A{1, 2, 3}},
	}
	b.ReportAllocs()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…