<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 22 Oct 2012, at 09:13, Dan Berindei <<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><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,</div></div></blockquote><div><br></div><div>Why? The patch was trivial. Implementing it is easy, and then doing a search and replace on the codebase again resulted in a pretty small patch.</div><br><blockquote type="cite"><div class="gmail_quote"><div> and further it imposes a burden on anyone writing code with collections in Infinispan.</div></div></blockquote><div><br></div><div>Is it that hard for a reviewer to spot? :) Maybe even write a script to check and warn for this.</div><br><blockquote type="cite"><div class="gmail_quote"><div> 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>
_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev</blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div><div><br></div><div><div>Platform Architect, JBoss Data Grid</div><div><a href="http://red.ht/data-grid">http://red.ht/data-grid</a></div></div></div></span></div></span></div></span>
</div>
<br></body></html>