]> Cypherpunks repositories - gostls13.git/commit
net/url: use bytes.Buffer in (*URL).String
authorAndrew Gerrand <adg@golang.org>
Wed, 23 Jan 2013 01:17:11 +0000 (12:17 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 23 Jan 2013 01:17:11 +0000 (12:17 +1100)
commitda82dfaccd6608a8e6d6b1a2633977dfa1e41c73
treee224bb7e944291f023024946d50fe399d32f1dfc
parentcdd6ae128894abbaf3fef0401cdef319f3ec1d3d
net/url: use bytes.Buffer in (*URL).String

BenchmarkString before:

        11990 ns/op            1621 B/op         73 allocs/op

Using bytes.Buffer:

        8774 ns/op            1994 B/op         40 allocs/op

I also tried making a version of escape() that writes directly to the
bytes.Buffer, but it only saved 1 alloc/op and increased CPU time by
about 10%. Didn't seem worth the extra code path.

R=bradfitz
CC=golang-dev
https://golang.org/cl/7182050
src/pkg/net/url/url.go
src/pkg/net/url/url_test.go