Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

=akka-http remove unnecessary copying of entity#2522

Merged
NateBrady23 merged 1 commit intoTechEmpower:masterfrom
ktoso:patch-1
Jan 27, 2017
Merged

=akka-http remove unnecessary copying of entity#2522
NateBrady23 merged 1 commit intoTechEmpower:masterfrom
ktoso:patch-1

Conversation

@ktoso
Copy link
Copy Markdown
Contributor

@ktoso ktoso commented Jan 26, 2017

Just a small improvement which I noticed while skimming the code.

The HttpEntity call made on this line already makes the content type be text/plain (UTF-8), the additional call made here created an entire copy of the entity object for each request and did not really have to do that since it is the right content type already. See here: https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala#L253

Just a small improvement which I noticed while skimming the code.

The HttpEntity call made on this line already makes the content type be `text/plain` (UTF-8), the additional call made here created an entire copy of the entity object for each request and did not really have to do that since it is the right content type already. See here: https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala#L253
https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala#L253
@knewmanTE
Copy link
Copy Markdown
Contributor

Good catch! This looks good to me if Travis agrees!

@ktoso
Copy link
Copy Markdown
Contributor Author

ktoso commented Jan 27, 2017

Thanks for merging!
I'll poke around the other ones to see if there's more small things like that somewhere.

@ktoso ktoso deleted the patch-1 branch January 27, 2017 09:39
zloster pushed a commit to zloster/FrameworkBenchmarks that referenced this pull request Mar 21, 2017
Just a small improvement which I noticed while skimming the code.

The HttpEntity call made on this line already makes the content type be `text/plain` (UTF-8), the additional call made here created an entire copy of the entity object for each request and did not really have to do that since it is the right content type already. See here: https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala#L253
https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpEntity.scala#L253
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants