<div class="gmail_quote">On Mon, Oct 22, 2012 at 9:25 AM, Galder Zamarreņo <span dir="ltr"><<a href="mailto:galder@redhat.com" target="_blank">galder@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Oct 19, 2012, at 6:28 PM, Dan Berindei <<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>> wrote:<br>
<br>
> Galder, what JDK are you using?<br>
<br>
</div>java version "1.6.0_35"<br>
Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)<br>
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)<br>
<div class="im"><br>
> OpenJDK 1.7 uses EmptyIterator.EMPTY_ITERATOR since 2007:<br>
><br>
> <a href="http://hg.openjdk.java.net/jdk7/jdk7/jdk/annotate/37a05a11f281/src/share/classes/java/util/Collections.java" target="_blank">http://hg.openjdk.java.net/jdk7/jdk7/jdk/annotate/37a05a11f281/src/share/classes/java/util/Collections.java</a><br>
<br>
</div>Good that the figured out this is non-sense.<br>
<div class="im"><br>
> I don't have JDK 1.6 sources on hand to check, but I don't think it's worth optimizing for such an old version anyway.<br>
<br>
</div>Why not? We support JDK 1.6, so nothing stops them from running it.<br>
<br>
Until we baseline on JDK7 (or 8), I'd leave it in.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br>My point was that it is a really big change, and further it imposes a burden on anyone writing code with collections in Infinispan. I'm sure we will spend non-trivial amounts of time during reviews pointing out places there the author should have used InfinispanCollections instead of Collections...<br>
<br>I would be willing to go for it if a benchmark showed a significant increase in performance after the change, but you didn't mention any benchmarks, so I guessed that you didn't see a big difference...<br><br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
><br>
> Cheers<br>
> Dan<br>
><br>
><br>
> On Fri, Oct 19, 2012 at 5:50 PM, Vladimir Blagojevic <<a href="mailto:vblagoje@redhat.com">vblagoje@redhat.com</a>> wrote:<br>
> Cool! Did not know about this! Is this original idea or others are<br>
> already doing this?<br>
> On 12-10-19 8:31 AM, Galder Zamarreņo wrote:<br>
> > Hi all,<br>
> ><br>
> > Re: <a href="https://github.com/galderz/infinispan/commit/0609207d13216de81d77ff51dc20652ce270c635" target="_blank">https://github.com/galderz/infinispan/commit/0609207d13216de81d77ff51dc20652ce270c635</a><br>
> ><br>
> > Please avoid using these JDK methods where possible. I've created alternative versions in InfinispanCollections util class that provide a better implementation.<br>
> ><br>
> > The problem with the JDK versions is that even if these collections are immutable, if you wanna iterate them (i.e. for(X : emptySet) ), they'll create a brand new Iterator every time they're looped, and that generates useless garbage.<br>
> ><br>
> > The InfinispanCollections versions of emptyX will return a constant singleton iterator which avoids this problem, and avoids the need for client code to check if the collection is empty before looping.<br>
> ><br>
> > Cheers,<br>
> > --<br>
> > Galder Zamarreņo<br>
> > <a href="mailto:galder@redhat.com">galder@redhat.com</a><br>
> > <a href="http://twitter.com/galderz" target="_blank">twitter.com/galderz</a><br>
> ><br>
> > Project Lead, Escalante<br>
> > <a href="http://escalante.io" target="_blank">http://escalante.io</a><br>
> ><br>
> > Engineer, Infinispan<br>
> > <a href="http://infinispan.org" target="_blank">http://infinispan.org</a><br>
> ><br></div></div></blockquote></div><br>