Commit 4615f651 authored by Kirill Smelkov's avatar Kirill Smelkov

X reduce allocations more

parent 3a528165
...@@ -20,7 +20,7 @@ func pyQuote(s string) string { ...@@ -20,7 +20,7 @@ func pyQuote(s string) string {
const hex = "0123456789abcdef" const hex = "0123456789abcdef"
func pyQuoteBytes(b []byte) []byte { func pyQuoteBytes(b []byte) []byte {
buf := make([]byte, 0, len(b) + 2/*quotes*/) // XXX revisit and do *1.5 ? or *2 buf := make([]byte, 0, (len(b) + 2) /* to reduce allocations when quoting */ * 2)
// smartquotes: choose ' or " as quoting character // smartquotes: choose ' or " as quoting character
// https://github.com/python/cpython/blob/v2.7.13-116-g1aa1803b3d/Objects/stringobject.c#L947 // https://github.com/python/cpython/blob/v2.7.13-116-g1aa1803b3d/Objects/stringobject.c#L947
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment