소스 검색

perf(fetcher): pre-allocate the cipherSuites

jvoisin 1 년 전
부모
커밋
af15032145
1개의 변경된 파일과 1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      internal/reader/fetcher/request_builder.go

+ 1 - 1
internal/reader/fetcher/request_builder.go

@@ -130,7 +130,7 @@ func (r *RequestBuilder) ExecuteRequest(requestURL string) (*http.Response, erro
 		// and the insecure ones if we are ignoring TLS errors. This allows to connect to badly configured servers anyway
 		// and the insecure ones if we are ignoring TLS errors. This allows to connect to badly configured servers anyway
 		ciphers = append(ciphers, tls.InsecureCipherSuites()...)
 		ciphers = append(ciphers, tls.InsecureCipherSuites()...)
 	}
 	}
-	cipherSuites := []uint16{}
+	cipherSuites := make([]uint16, 0, len(ciphers))
 	for _, cipher := range ciphers {
 	for _, cipher := range ciphers {
 		cipherSuites = append(cipherSuites, cipher.ID)
 		cipherSuites = append(cipherSuites, cipher.ID)
 	}
 	}