]> Cypherpunks repositories - gostls13.git/commit
fmt: replace channel cache with slice.
authorRob Pike <r@golang.org>
Thu, 29 Sep 2011 18:23:06 +0000 (11:23 -0700)
committerRob Pike <r@golang.org>
Thu, 29 Sep 2011 18:23:06 +0000 (11:23 -0700)
commit12ad9b4315ccbcc17b35b51a4a4b5c6fc377bb42
treed04589fbcb34be79a5d50bbc27b204c43748196f
parent1a13f9b810bc5ba43aa9786d06a0d06a58f1e110
fmt: replace channel cache with slice.
Simpler concept, and it turns a queue into a stack.
Speeds up benchmarks noticeably.

Before:
fmt_test.BenchmarkSprintfEmpty 10000000        282 ns/op
fmt_test.BenchmarkSprintfString  2000000        910 ns/op
fmt_test.BenchmarkSprintfInt  5000000        723 ns/op
fmt_test.BenchmarkSprintfIntInt  1000000       1071 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  1000000       1108 ns/op
fmt_test.BenchmarkScanInts     1000    2239510 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2365432 ns/op

After:
fmt_test.BenchmarkSprintfEmpty 10000000        232 ns/op
fmt_test.BenchmarkSprintfString  2000000        837 ns/op
fmt_test.BenchmarkSprintfInt  5000000        590 ns/op
fmt_test.BenchmarkSprintfIntInt  2000000        910 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  2000000        996 ns/op
fmt_test.BenchmarkScanInts     1000    2210715 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2367800 ns/op

R=rsc, r
CC=golang-dev
https://golang.org/cl/5151044
src/pkg/fmt/print.go