浏览代码

http2/hpack: make staticTable an array, not a slice

Minor performance improvement, since len(staticTable) is then a
constant at compile time.

Change-Id: Ie51ecc985aa3f40d50f0a7d1ab6ac91738f696d5
Reviewed-on: https://go-review.googlesource.com/15731
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick 10 年之前
父节点
当前提交
4b709d9377
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      http2/hpack/tables.go

+ 1 - 1
http2/hpack/tables.go

@@ -10,7 +10,7 @@ func pair(name, value string) HeaderField {
 }
 
 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B
-var staticTable = []HeaderField{
+var staticTable = [...]HeaderField{
 	pair(":authority", ""), // index 1 (1-based)
 	pair(":method", "GET"),
 	pair(":method", "POST"),