-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/7074/
-----------------------------------------------------------
(Updated Sept. 15, 2012, 11:02 p.m.)
Review request for shindig, Ryan Baxter, Dan Dumont, Stanton Sievers, and Rich
Thompson.
Description
-------
The AllJsIframeVersioner causes a massive memory allocation executing the
following:
StringBuilder jsBuf = new StringBuilder();
for (FeatureResource resource : registry.getAllFeatures().getResources()) {
jsBuf.append(resource.getContent()).append(resource.getDebugContent());
}
this.allJsChecksum = HashUtil.checksum(jsBuf.toString().getBytes());
The two problems with this are:
(1) Creates a massive char[] for that string (we tested with a 4M resource)
(2) Then allocates a new byte[] for that giant string
Proposed solution is to just use a simple message digest object against each
resource content. And concat all the bytes for HashUtil.checksum.
This addresses bug SHINDIG-1867.
https://issues.apache.org/jira/browse/SHINDIG-1867
Diffs
-----
http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/AllJsIframeVersioner.java
1384320
http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/uri/AllJsIframeVersionerTest.java
1384320
Diff: https://reviews.apache.org/r/7074/diff/
Testing
-------
Done.
Thanks,
Marshall Shi