Niraj Tolia created JCLOUDS-302:
-----------------------------------
Summary: Prevent unnecessary HttpMessage String generation in
HTTPUtils
Key: JCLOUDS-302
URL: https://issues.apache.org/jira/browse/JCLOUDS-302
Project: jclouds
Issue Type: Bug
Components: jclouds-core
Affects Versions: 1.6.2, 1.7.0
Reporter: Niraj Tolia
Priority: Trivial
Fix For: 1.7.0, 1.6.2
HttpUtils.checkRequestHasRequiredProperties() has a number of Preconditions
checks that generate an error string using concatenation. In particular, the
HttpMessage being checked is added to the error string multiple times and this
invokes the HttpMessage.toString() function. This generated String is promptly
thrown away in the majority of cases where the Preconditions checks are not
triggered.
This wasted work shows up as a hotspot in my microbenchmark profiling in terms
of object allocation (8% of total allocations). While fixing it by switching to
using the String format version of the Preconditions API does lead to a
measurable improvement, the improvement is small. However, this is a low risk
change to make and I will therefore push a patch for review.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira