﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;font color="black"&gt;&lt;b&gt;Heisen&lt;font color="#DF0101"&gt;bug&lt;/font&gt; Experiment&lt;/b&gt;&lt;/font&gt;-最新评论</title><link>http://www.blogjava.net/parkerwy/CommentsRSS.aspx</link><description /><language>zh-cn</language><pubDate>Sat, 13 Nov 2010 03:04:43 GMT</pubDate><lastBuildDate>Sat, 13 Nov 2010 03:04:43 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: log4j 的继任者：slf4j &amp;amp; logback</title><link>http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299983</link><dc:creator>Parker</dc:creator><author>Parker</author><pubDate>Tue, 27 Oct 2009 14:12:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299983</guid><description><![CDATA[@隔叶黄莺<br>可以考虑一下这两个情况：<br>1. 如果从 commons-logging 桥接到 log4j 是 O(1)，那么从 commons-logging 桥接到 slf4j 再桥接到 log4j 则是O(2)，复杂度均为常数。<br>2. 直接调用一个方法和通过反射调用的效率大概差了三个数量级，如果瓶颈真的出现在这个层面的话，恐怕首先要考虑的是限制对反射的使用，那很多主流框架直接就出局了。<img src ="http://www.blogjava.net/parkerwy/aggbug/299983.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">Parker</a> 2009-10-27 22:12 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299983#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: log4j 的继任者：slf4j &amp;amp; logback</title><link>http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299881</link><dc:creator>隔叶黄莺</dc:creator><author>隔叶黄莺</author><pubDate>Tue, 27 Oct 2009 02:12:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299881</guid><description><![CDATA[原来关注过 slf4j，在有些新的组件中就改用了它，比如 Hibernate 新版中。<br>考虑过一个事情就是大多数组件都用的是 common-logging，如何把它们都桥接到 slf4j 来的问题， 以及性能会如何。<img src ="http://www.blogjava.net/parkerwy/aggbug/299881.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">隔叶黄莺</a> 2009-10-27 10:12 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/27/299675.html#299881#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298650</link><dc:creator>Parker</dc:creator><author>Parker</author><pubDate>Fri, 16 Oct 2009 15:27:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298650</guid><description><![CDATA[@YYX<br>在StringBuilder的构造函数里设个断点，然后Debug你这段代码，很容易数出来到底创建了多少个instance。<img src ="http://www.blogjava.net/parkerwy/aggbug/298650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">Parker</a> 2009-10-16 23:27 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298650#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298485</link><dc:creator>YYX</dc:creator><author>YYX</author><pubDate>Thu, 15 Oct 2009 17:34:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298485</guid><description><![CDATA[@Parker<br>你考虑下这个情况<br>String a =&quot;a&quot;,b=&quot;b&quot;<br>String c = a+&quot;c&quot;+b+&quot;d&quot;;<br>a+&quot;c&quot;要新建一个StringBuilder , 接着继续+ b要新建另一个StringBuilder，以此类推，加几次新建几个。 <br>如果是用一个 StringBUilder全程append，就只需要新建这一个StringBuilder。<img src ="http://www.blogjava.net/parkerwy/aggbug/298485.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">YYX</a> 2009-10-16 01:34 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/16/297730.html#298485#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297981</link><dc:creator>Parker</dc:creator><author>Parker</author><pubDate>Mon, 12 Oct 2009 13:51:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297981</guid><description><![CDATA[@dennis<br>编译器的差异有两种情况，更坏或更好，直接使用 StringBuffer 虽然避免了更坏的结果，但同时也阻碍了更好的结果。到底遇到哪种情况的可能性更大要根据现实情况分析，是否直接使用 StringBuffer 应该是权衡这些因素之后的决定，直接使用 StringBuffer 是一种 hard coding，不应该简单地认为使用了 StringBuffer 就万无一失了。<br><br>说回现实中，我已经在 Sun 和 IBM 的 JDK 上验证过了，如果有条件在其它厂商的 JDK 上进行验证的请补充结果。我谨慎但乐观地推测大部分人不太可能会遇到你假想的这种更坏的情况。<img src ="http://www.blogjava.net/parkerwy/aggbug/297981.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">Parker</a> 2009-10-12 21:51 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297981#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297872</link><dc:creator>Scorpio Zhen</dc:creator><author>Scorpio Zhen</author><pubDate>Mon, 12 Oct 2009 04:05:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297872</guid><description><![CDATA[有道理<img src ="http://www.blogjava.net/parkerwy/aggbug/297872.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">Scorpio Zhen</a> 2009-10-12 12:05 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297872#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer [未登录]</title><link>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297843</link><dc:creator>dg</dc:creator><author>dg</author><pubDate>Mon, 12 Oct 2009 01:29:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297843</guid><description><![CDATA[关键是编译时还是运行时的问题，能在编译时能确定下来就在编译时确定从而避免运行时创建多于的对象<img src ="http://www.blogjava.net/parkerwy/aggbug/297843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">dg</a> 2009-10-12 09:29 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297843#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer [未登录]</title><link>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297839</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Mon, 12 Oct 2009 01:21:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297839</guid><description><![CDATA[@Parker<br>这样其实把工作交给了编译器的优化手段，依赖于编译器的优化总不是可移植的手段。毕竟，你的代码是可能使用其他编译器编译的。我明白你的担心，单其实如果你的字面量字符串拼接不是很频繁的话，用StringBuffer，还是用+号，这点差距是微不足道的，反而容易让自己混淆，而用StringBuffer总是没大错。<img src ="http://www.blogjava.net/parkerwy/aggbug/297839.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">dennis</a> 2009-10-12 09:21 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/12/297730.html#297839#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297818</link><dc:creator>Parker</dc:creator><author>Parker</author><pubDate>Sun, 11 Oct 2009 13:59:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297818</guid><description><![CDATA[@dennis<br>我的观点就是尽量用+，尽量不要显式地使用StringBuffer，让编译器在背后偷偷地用。<img src ="http://www.blogjava.net/parkerwy/aggbug/297818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">Parker</a> 2009-10-11 21:59 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297818#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 别过度使用StringBuffer </title><link>http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297814</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Sun, 11 Oct 2009 13:18:00 GMT</pubDate><guid>http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297814</guid><description><![CDATA[我已经弄不明白你的观点了。字符串拼接要么在字面量，要么是变量，如果涉及到变量，无论如何都要用StringBuffer或者StringBuilder，这还有什么疑义？哪有什么过度不过度的。如果是字面量的拼接，当然你可以用+号，但是如果不是那么频繁，用用StringBuffer也不是什么天大的事情。<img src ="http://www.blogjava.net/parkerwy/aggbug/297814.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/parkerwy/" target="_blank">dennis</a> 2009-10-11 21:18 <a href="http://www.blogjava.net/parkerwy/archive/2009/10/11/297730.html#297814#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>