Retour au cours

Benchmarks Go : Mesurer la vitesse du code

Go (Golang) pour les microservices cloud-native

Écrire des Benchmarks

À quelle vitesse fonctionne votre analyseur JSON ? Écrivez un benchmark pour le savoir.

go func BenchmarkParse(b *testing.B) { for i := 0; i < b.N; i++ { Parse(data) } }

Exécutez avec go test -bench=.. Go exécutera la boucle N fois pour obtenir un résultat statistiquement significatif.