forked from mirror/gin
Performance improvement when writing formatted strings
This commit is contained in:
parent
1f6304ca25
commit
d33079d0ec
|
@ -74,7 +74,7 @@ func (_ plainTextRender) Render(w http.ResponseWriter, code int, data ...interfa
|
|||
format := data[0].(string)
|
||||
args := data[1].([]interface{})
|
||||
if len(args) > 0 {
|
||||
_, err = w.Write([]byte(fmt.Sprintf(format, args...)))
|
||||
_, err = fmt.Fprintf(w, format, args...)
|
||||
} else {
|
||||
_, err = w.Write([]byte(format))
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ func (_ htmlPlainRender) Render(w http.ResponseWriter, code int, data ...interfa
|
|||
format := data[0].(string)
|
||||
args := data[1].([]interface{})
|
||||
if len(args) > 0 {
|
||||
_, err = w.Write([]byte(fmt.Sprintf(format, args...)))
|
||||
_, err = fmt.Fprintf(w, format, args...)
|
||||
} else {
|
||||
_, err = w.Write([]byte(format))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue