Write benchmark

create benchmark function into word/word_test.go

func BenchmarkIsPalindrome(b *testing.B) {
    for i := 0; i < b.N; i++ {
        IsPalindrome("A man, a plan, a canal: Panama")
    }
}
go test -bench=.
go test -bench=IsPalindrome

The suffix 4 indicates the numbers of GOMAXPROCS.

The fastest program is often the one that makes the fewest memory allocations.

go test -bench=. -benchmem // will include memory allocation statistics in the report

results matching ""

    No results matching ""