-
Notifications
You must be signed in to change notification settings - Fork 267
Could we avoid allocation of UTF8 byte array? #692
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,8 +503,7 @@ module Core = | |
| /// <param name="str">The string value to be send back to the client.</param> | ||
| /// <returns>A Giraffe <see cref="HttpHandler" /> function which can be composed into a bigger web application.</returns> | ||
| let setBodyFromString (str: string) : HttpHandler = | ||
| let bytes = Encoding.UTF8.GetBytes str | ||
| fun (_: HttpFunc) (ctx: HttpContext) -> ctx.WriteBytesAsync bytes | ||
| fun (_: HttpFunc) (ctx: HttpContext) -> ctx.WriteStringAsync str | ||
|
Thorium marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We might need to check the IL/ASM and run a benchmark to check if there's any noticeable performance improvement. Furthermore, if we make this change, I'd like to add new automated tests to assert things are still working in the long run. |
||
|
|
||
| /// <summary> | ||
| /// Writes an UTF-8 encoded string to the body of the HTTP response and sets the HTTP Content-Length header accordingly, as well as the Content-Type header to text/plain. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.