Skip to content
This repository
tree: 51b7af73e3
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 21 lines (18 sloc) 0.376 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package pat

import (
"net/http"
"testing"
)

func BenchmarkPatternMatching(b *testing.B) {
p := New()
p.Get("/hello/:name", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
for n := 0; n < b.N; n++ {
b.StopTimer()
r, err := http.NewRequest("GET", "/hello/blake", nil)
if err != nil {
panic(err)
}
b.StartTimer()
p.ServeHTTP(nil, r)
}
}
Something went wrong with that request. Please try again.