Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Martin Buchholz
+1 On Fri, Jun 15, 2018 at 2:52 PM, Paul Sandoz wrote: > > > On Jun 15, 2018, at 2:24 PM, Martin Buchholz wrote: > > Still looks correct, but I might keep looking for something more elegant. > What bothers me a little now is > > 1290 long word = words[u] & (WORD_MASK <<

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Paul Sandoz
> On Jun 15, 2018, at 2:24 PM, Martin Buchholz wrote: > > Still looks correct, but I might keep looking for something more elegant. > What bothers me a little now is > > 1290 long word = words[u] & (WORD_MASK << i); > > which is part of the initial setup and is not n

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Martin Buchholz
Still looks correct, but I might keep looking for something more elegant. What bothers me a little now is 1290 long word = words[u] & (WORD_MASK << i); which is part of the initial setup and is not necessary on each iteration. On Fri, Jun 15, 2018 at 1:13 PM, Paul Sando

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Paul Sandoz
Thanks! Doh, obvious in hindsight. > On Jun 15, 2018, at 11:05 AM, Martin Buchholz wrote: > > It took me a while to realize why you were checking tz < 63. It's because > the shift by 64 that might occur below would be a no-op! Right! > 1301 action.accept(i++); > 1

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Martin Buchholz
It took me a while to realize why you were checking tz < 63. It's because the shift by 64 that might occur below would be a no-op! 1301 action.accept(i++);1302 word &= (WORD_MASK << i); Can we rewrite to simply flip the one bit via word &= ~(1L << i); a

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Paul Sandoz
Hi Martin, Thanks for reviewing. > On Jun 15, 2018, at 7:57 AM, Martin Buchholz wrote: > > Code looks correct to me, but as usual there are some things I would try to > do differently, > Indeed, i tried a few different approaches before settling on this code shape. > 1292

Re: RFR 8170159 Improve the performance of BitSet traversal

2018-06-15 Thread Martin Buchholz
Code looks correct to me, but as usual there are some things I would try to do differently, 1292 while (word != 0 && tz < 63) { I'd try to make this loop simply while (word != 0) --- Probably neither of us is fond of the bug magnet special case for Integer.MAX_VALUE. M

RFR 8170159 Improve the performance of BitSet traversal

2018-06-14 Thread Paul Sandoz
Hi, Please review this enhancement to improve the performance of BitSet traversal when using a stream. http://cr.openjdk.java.net/~psandoz/jdk/JDK-8170159-bitset-traverse/webrev/ The associated issue started out li