summaryrefslogtreecommitdiff
path: root/libgo/go/strconv/quote_test.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-22 18:15:38 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-22 18:15:38 +0000
commitbe239ed2ba619747b64629895116f209b58baee8 (patch)
treeabdbd898676e1f853fca2d7e031d105d7ebcf676 /libgo/go/strconv/quote_test.go
parent8f60bf3b0c426d469b5e65e1ad943e21ad42d957 (diff)
downloadgcc-be239ed2ba619747b64629895116f209b58baee8.tar.gz
libgo: update to go1.7rc3
Reviewed-on: https://go-review.googlesource.com/25150 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238662 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/strconv/quote_test.go')
-rw-r--r--libgo/go/strconv/quote_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/libgo/go/strconv/quote_test.go b/libgo/go/strconv/quote_test.go
index 3e8ec2c98f3..10735e316c7 100644
--- a/libgo/go/strconv/quote_test.go
+++ b/libgo/go/strconv/quote_test.go
@@ -89,6 +89,34 @@ func TestQuoteToGraphic(t *testing.T) {
}
}
+func BenchmarkQuote(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ Quote("\a\b\f\r\n\t\v\a\b\f\r\n\t\v\a\b\f\r\n\t\v")
+ }
+}
+
+func BenchmarkQuoteRune(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ QuoteRune('\a')
+ }
+}
+
+var benchQuoteBuf []byte
+
+func BenchmarkAppendQuote(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ benchQuoteBuf = AppendQuote(benchQuoteBuf[:0], "\a\b\f\r\n\t\v\a\b\f\r\n\t\v\a\b\f\r\n\t\v")
+ }
+}
+
+var benchQuoteRuneBuf []byte
+
+func BenchmarkAppendQuoteRune(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ benchQuoteRuneBuf = AppendQuoteRune(benchQuoteRuneBuf[:0], '\a')
+ }
+}
+
type quoteRuneTest struct {
in rune
out string