-
Clayton Coleman authored
A self link should only require one allocation, and we should skip url.PathEscape() except when the path actually needs it. Add a fuzz test to build random strings and verify them against the optimized implementation. Add a new BenchmarkWatchHTTP_UTF8 that covers when we have unicode names in the self link. ``` > before BenchmarkGet-12 10000 118863 ns/op 17482 B/op 130 allocs/op BenchmarkWatchHTTP-12 30000 38346 ns/op 1893 B/op 29 allocs/op > after BenchmarkGet-12 10000 116218 ns/op 17456 B/op 130 allocs/op BenchmarkWatchHTTP-12 50000 35988 ns/op 1571 B/op 26 allocs/op BenchmarkWatchHTTP_UTF8-12 50000 41467 ns/op 1928 B/op 28 allocs/op ``` Saves 3 allocations in the fast path and 1 in the slow path (the slow path has to build the buffer and then call url.EscapedPath which always allocates).