INNER CODE UNIT · Go

BenchmarkBsonD2M

simagix/hatchet · benchmark_test.go:35

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()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		BsonD2M(d)
	}
}

// BenchmarkBsonD2M_Old benchmarks the old Marshal/Unmarshal approach
func BenchmarkBsonD2M_Old(b *testing.B) {
	d := bson.D{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…