Исходники и презентации

This commit is contained in:
2025-05-23 07:26:39 +03:00
parent aa948179d5
commit 02d8430a3a
514 changed files with 13773 additions and 0 deletions

View File

@ -0,0 +1,21 @@
package main
import "testing"
// go test -bench=. performance_test.go
func BenchmarkWithSlice(b *testing.B) {
slice := []int{1, 2, 3}
for i := 0; i < b.N; i++ {
value := slice[1]
slice[1] = value
}
}
func BenchmarkWithHashTable(b *testing.B) {
table := map[int]int{0: 1, 1: 2, 2: 3}
for i := 0; i < b.N; i++ {
value := table[1]
table[1] = value
}
}