spray/spray — pull request #741 by fwbrasil (2013-12-28 02:33:24+00:00)
Title: performance - avoid try parse if there isn't bytes to read

After each request read there is a call to HttpMessagePartParser.parseMessageSafe that provokes a NotEnoughDataException. With this PR the method verifies if there are bytes to read before try to parse.

Before the modification, spray was the bottleneck on a load test where each request is done using a new connection. This is the yourkit hotspots view:

![yourkit](https://f.cloud.github.com/assets/831175/1817035/0b732f68-6f68-11e3-849d-299c05b391d8.png)

After the modification, the spray bottleneck is solved:

![yourkit-patched](https://f.cloud.github.com/assets/831175/1817036/1c2fd86a-6f68-11e3-9b98-ad91dd00a831.png)

More information on this thread:

https://groups.google.com/forum/#!topic/spray-user/upJkAjK8F-A