<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hacking on java.lang.String</title>
	<atom:link href="http://puredanger.com/kablooie/index.php/2008/03/14/hacking-on-javalangstring/feed/" rel="self" type="application/rss+xml" />
	<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/</link>
	<description>Scott Bale's technical blog</description>
	<lastBuildDate>Tue, 26 Jul 2011 08:42:38 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steve</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-46</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 20 Mar 2008 11:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-46</guid>
		<description>Interesting and creative idea but I don&#039;t think it would work. I think arrays rely on special bytecode instructions for setting and getting it&#039;s indexed fields instead of methods.</description>
		<content:encoded><![CDATA[<p>Interesting and creative idea but I don&#8217;t think it would work. I think arrays rely on special bytecode instructions for setting and getting it&#8217;s indexed fields instead of methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter lawrey</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-45</link>
		<dc:creator>peter lawrey</dc:creator>
		<pubDate>Thu, 20 Mar 2008 09:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-45</guid>
		<description>I take your point re: different JDKs. You could have changes between versions of the same JDK. 
The approach I have taken to writing ASM code is to write basically what I want in Java, use the ASMifier to dump the code required and generalise it.

{: Its occurred to me you could override Object to change the behaviour of primitive arrays. :}</description>
		<content:encoded><![CDATA[<p>I take your point re: different JDKs. You could have changes between versions of the same JDK.<br />
The approach I have taken to writing ASM code is to write basically what I want in Java, use the ASMifier to dump the code required and generalise it.</p>
<p>{: Its occurred to me you could override Object to change the behaviour of primitive arrays. :}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-44</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 20 Mar 2008 04:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-44</guid>
		<description>@Peter - thanks for the comment and link.  Yes, yours is a much more straightforward way to accomplish the same thing.  At Terracotta it made sense to use ASM since we are already doing quite a lot of dynamic bytecode instrumentation (we have to in order to cluster any arbitrary client code) and have a framework for it.  ASM makes it straightforward to, say, intercept field-level reads of &quot;value&quot; char[] field and route them through our __tc_getvalue() method, although you can certainly code that by hand.  Also, our dynamic bootjar generation shields the users from slight variations of String source code in sun, ibm and azul JDKs.</description>
		<content:encoded><![CDATA[<p>@Peter &#8211; thanks for the comment and link.  Yes, yours is a much more straightforward way to accomplish the same thing.  At Terracotta it made sense to use ASM since we are already doing quite a lot of dynamic bytecode instrumentation (we have to in order to cluster any arbitrary client code) and have a framework for it.  ASM makes it straightforward to, say, intercept field-level reads of &#8220;value&#8221; char[] field and route them through our __tc_getvalue() method, although you can certainly code that by hand.  Also, our dynamic bootjar generation shields the users from slight variations of String source code in sun, ibm and azul JDKs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Lawrey</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-43</link>
		<dc:creator>Peter Lawrey</dc:creator>
		<pubDate>Wed, 19 Mar 2008 22:08:56 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-43</guid>
		<description>I like ASM and the idea of dynamic instrumentation however I believe in this case a simpler approach would be to just create a customised version of the String class and use that.

The linked example compresses Strings longer than 1024 characters.
http://www.freshvanilla.org:8080/display/www/Compressing+java.lang.String

The included unit test outputs
String of length=38890 uses 18527 bytes.</description>
		<content:encoded><![CDATA[<p>I like ASM and the idea of dynamic instrumentation however I believe in this case a simpler approach would be to just create a customised version of the String class and use that.</p>
<p>The linked example compresses Strings longer than 1024 characters.<br />
<a href="http://www.freshvanilla.org:8080/display/www/Compressing+java.lang.String" rel="nofollow">http://www.freshvanilla.org:8080/display/www/Compressing+java.lang.String</a></p>
<p>The included unit test outputs<br />
String of length=38890 uses 18527 bytes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-41</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 18 Mar 2008 23:53:56 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-41</guid>
		<description>@Tim - good points, and it would probably take me (or better yet one of my smarter teammates) at least an entire post to properly address them all.  But a couple things: the optimizations I&#039;m talking about in this blog are more concerned with conserving heap space on a cluster (L1) node.  Imagine a clustered Map cache with large String values (say, XML documents).  The heaps of all L1 nodes are impacted by a large String cache.  With these optimizations, even though each L1 node takes a CPU hit each time it compresses a String, the tradeoff is less heap usage for all L1 nodes (assuming each L1 nodes doesn&#039;t need to access every single value in the clustered cache).  And of course this is all configurable - you can turn String compression on/off and set the String size at which it kicks in.  So you could say we&#039;re tackling use cases where the L1 heap is the bottleneck.  It&#039;s definitely a balancing act, and one that we are continuing to test and profile.</description>
		<content:encoded><![CDATA[<p>@Tim &#8211; good points, and it would probably take me (or better yet one of my smarter teammates) at least an entire post to properly address them all.  But a couple things: the optimizations I&#8217;m talking about in this blog are more concerned with conserving heap space on a cluster (L1) node.  Imagine a clustered Map cache with large String values (say, XML documents).  The heaps of all L1 nodes are impacted by a large String cache.  With these optimizations, even though each L1 node takes a CPU hit each time it compresses a String, the tradeoff is less heap usage for all L1 nodes (assuming each L1 nodes doesn&#8217;t need to access every single value in the clustered cache).  And of course this is all configurable &#8211; you can turn String compression on/off and set the String size at which it kicks in.  So you could say we&#8217;re tackling use cases where the L1 heap is the bottleneck.  It&#8217;s definitely a balancing act, and one that we are continuing to test and profile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-40</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 18 Mar 2008 23:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-40</guid>
		<description>The short answer is depends.

If one is using large strings then it doesn&#039;t take long before the network is the bottleneck. Also, having the strings compressed means less processing by the server, less GC on the server and less data to write to disk. Another advantage of doing the compression on the client is that actually, the client is rarely CPU bound and has horsepower to spare. Another cool thing about this approach is that nodes that receive the compressed strings may never have to decompress them or not have to decompress them for some time saving considerable memory. Keep in mind that it is important to only compress strings over a certain size and that size is configurable. In the future we may also do tricks like proxifying strings.</description>
		<content:encoded><![CDATA[<p>The short answer is depends.</p>
<p>If one is using large strings then it doesn&#8217;t take long before the network is the bottleneck. Also, having the strings compressed means less processing by the server, less GC on the server and less data to write to disk. Another advantage of doing the compression on the client is that actually, the client is rarely CPU bound and has horsepower to spare. Another cool thing about this approach is that nodes that receive the compressed strings may never have to decompress them or not have to decompress them for some time saving considerable memory. Keep in mind that it is important to only compress strings over a certain size and that size is configurable. In the future we may also do tricks like proxifying strings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-39</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Tue, 18 Mar 2008 22:24:26 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-39</guid>
		<description>I&#039;ve looked at String compression before to speed up network communications.  It seems that unless the network is a significant bottleneck, the added cost of CPU cycles invalidates the benefits gained by the compression.

In short, doesn&#039;t compressing kill your scalability due to CPU loads?  The network is not usually the bottleneck.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve looked at String compression before to speed up network communications.  It seems that unless the network is a significant bottleneck, the added cost of CPU cycles invalidates the benefits gained by the compression.</p>
<p>In short, doesn&#8217;t compressing kill your scalability due to CPU loads?  The network is not usually the bottleneck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guy</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-35</link>
		<dc:creator>Guy</dc:creator>
		<pubDate>Sun, 16 Mar 2008 06:12:10 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-35</guid>
		<description>Thanks that would be great, I&#039;m trying to build a monitoring system that required this capability. 
And I couldn&#039;t find a way to instrument the classes that were loaded before my javaagent.</description>
		<content:encoded><![CDATA[<p>Thanks that would be great, I&#8217;m trying to build a monitoring system that required this capability.<br />
And I couldn&#8217;t find a way to instrument the classes that were loaded before my javaagent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-34</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Sun, 16 Mar 2008 03:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-34</guid>
		<description>@Guy - as soon as time permits I&#039;d like to write a whole nother post about just what Terracotta&#039;s dso-java process does, including how instrumentation happens during Class loading.  Stay tuned :)</description>
		<content:encoded><![CDATA[<p>@Guy &#8211; as soon as time permits I&#8217;d like to write a whole nother post about just what Terracotta&#8217;s dso-java process does, including how instrumentation happens during Class loading.  Stay tuned <img src='http://puredanger.com/kablooie/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guy</title>
		<link>http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/comment-page-1/#comment-33</link>
		<dc:creator>Guy</dc:creator>
		<pubDate>Sat, 15 Mar 2008 22:33:13 +0000</pubDate>
		<guid isPermaLink="false">http://puredanger.com/kablooie/2008/03/14/hacking-on-javalangstring/#comment-33</guid>
		<description>Can you extend more on how you were able to instrument java.lang.String?</description>
		<content:encoded><![CDATA[<p>Can you extend more on how you were able to instrument java.lang.String?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.314 seconds -->

