You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to figure out why calling {hello: "world"}.to_json(http_response) is so much slower than http_response.print({hello: "world"}.to_json). This seems like it could be one of the issues since my guess is that the response io would be flushed 3 times per request in the slow version and only once in the quicker. PR updating TechEmpower benchmarks: TechEmpower/FrameworkBenchmarks#6584
I tried referencing other builders but it seems that every one does it differently:
Looks like the double flushes were added in this PR #9321 which was made to align the builders flush methods though it didn't remove the old flush calls like it probably should have.
JSON
crystal/src/json/builder.cr
Line 56 in 3b5bc55
crystal/src/json/builder.cr
Line 418 in 3b5bc55
YAML
crystal/src/yaml/builder.cr
Line 67 in 3b5bc55
crystal/src/yaml/builder.cr
Line 56 in 3b5bc55
Trying to figure out why calling
{hello: "world"}.to_json(http_response)
is so much slower thanhttp_response.print({hello: "world"}.to_json)
. This seems like it could be one of the issues since my guess is that the response io would be flushed 3 times per request in the slow version and only once in the quicker. PR updating TechEmpower benchmarks: TechEmpower/FrameworkBenchmarks#6584I tried referencing other builders but it seems that every one does it differently:
The text was updated successfully, but these errors were encountered: