Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use io.Writer instead of []byte in Render() method #240

Open
frederikhors opened this issue Aug 4, 2019 · 1 comment
Open

Use io.Writer instead of []byte in Render() method #240

frederikhors opened this issue Aug 4, 2019 · 1 comment

Comments

@frederikhors
Copy link
Contributor

Discussing with the great developer @valyala in thread valyala/quicktemplate#58 about the amazing Authboss he gave us a suggestion to optimize a bit: valyala/quicktemplate#58 (comment)

As for the performance ... superfluous memory allocation when returning the byte slice from bytes.Buffer. The memory allocation could be avoided if Render() could accept io.Writer to write template output to.`

Can we just use io.Writer instead of []byte in Render() method?

@aarondl
Copy link
Member

aarondl commented Aug 20, 2019

Although he's correct, the main reason for this to exist is to enable a JSON renderer which doesn't accept an io.Writer anywhere. I'm really not opposed to the change, but it would have to be a RenderWriter interface we upgrade to from a Renderer otherwise it'd break backwards compatability. I'd accept a PR for this, will not implement it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants