Remove unnecessary allocs on JSON#1191
Closed
ribice wants to merge 1 commit intolabstack:masterfrom
ribice:json-render
Closed
Remove unnecessary allocs on JSON#1191ribice wants to merge 1 commit intolabstack:masterfrom ribice:json-render
ribice wants to merge 1 commit intolabstack:masterfrom
ribice:json-render
Conversation
Contributor
Author
|
I can fix the failing test, if you are interested in this change? |
Contributor
|
Good idea.. @vishr / @alexaandru what you think about? |
ribice
commented
Sep 19, 2018
| return | ||
| } | ||
| return c.JSONBlob(code, b) | ||
| return c.jsonBlob(code, i) |
Contributor
Author
There was a problem hiding this comment.
Since jsonBlob is simple, the code can be moved directly here.
Member
|
@ribice I think we should do it the same for |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
vishr
pushed a commit
that referenced
this pull request
Jan 14, 2019
* [extend #1191] Unnecessary alloc for XML, JSON, JSONP * add legacy (JSON/JSONP/XML)Blob tests * fix namings * fix `jsonPBlob` allocs * fix review comments (thx @alexaandru) * fix review comments (thx @alexaandru) add benchmarks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added new method to keep backwards compatibility (for those directly using JSONBlob).
Removes the alloc in JSON method to
[]byte(json.Marshal(i))and directly writes to http.ResponseWriter.