<br><div class="gmail_quote">On Mon, Oct 22, 2012 at 3:47 PM, Manik Surtani <span dir="ltr"><<a href="mailto:manik@jboss.org" target="_blank">manik@jboss.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div class="im"><div>On 22 Oct 2012, at 09:13, Dan Berindei <<a href="mailto:dan.berindei@gmail.com" target="_blank">dan.berindei@gmail.com</a>> wrote:</div><br><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><br>
On Oct 19, 2012, at 6:28 PM, Dan Berindei <<a href="mailto:dan.berindei@gmail.com" target="_blank">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><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><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><div><br></div></div></blockquote><div><br>My point was that it is a really big change,</div></div></blockquote><div><br></div></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>
<div class="im"><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><div>Is it that hard for a reviewer to spot? :) Maybe even write a script to check and warn for this.</div>
<br></div></div></blockquote><div><br>I'm not saying it's hard, but he'll have to write a comment, the author will have to notice the comment and update the PR, then the reviewer will have to notice the PR update and look at it again, and so on.<br>
<br>All these things take time, and I would rather not invest that time if we can't see an improvement in performance.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><blockquote type="cite"><div class="im"><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><div>
><br>
> Cheers<br>
> Dan<br>
><br>
><br>
> On Fri, Oct 19, 2012 at 5:50 PM, Vladimir Blagojevic <<a href="mailto:vblagoje@redhat.com" target="_blank">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" target="_blank">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></div><div class="im">
_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></div>
</blockquote></div><br><div>
<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org" target="_blank">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani" target="_blank">twitter.com/maniksurtani</a></div><div><br>
</div><div><div>Platform Architect, JBoss Data Grid</div><div><a href="http://red.ht/data-grid" target="_blank">http://red.ht/data-grid</a></div></div></div></span></div></span></div></span>
</div>
<br></div><br>_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br></blockquote></div><br>