[
https://issues.apache.org/jira/browse/DERBY-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468277
]
Øystein Grøvlen commented on DERBY-2191:
----------------------------------------
> Dyre Tjeldvoll commented on DERBY-2191:
> ---------------------------------------
>
> I agree that the javadoc comment for anySetBit should be improved,
> and will include this in the next version of the patch.
Good.
>
> I'll take a look at ResultColumnList.generateHolderMethod() and see
> if anything can be done.
Before putting too much effort into that, I think you should consider
whether this is a time critical function. Since its seem to be used
during compilation, it might not be that critical.
>
> Wrt. firstSet(): I did consider your approach, but that will always
> result in 4 comparisons. The current approach will give an average
> of 4 comparisons if the set bits are uniformly distributed in the
> byte. If you look at how firstSet is used in anySetBit(int) you'll
> see that the argument is frequently shifted a number of bits to the
> left. So the bits are not uniformly distributed, but rather
> clustered in the beginning of the byte.
Good point, and thinking a bit more about this, even if my suggestion
will always give 3 (not 4!) comparisons, I think your way is probably
better also when you do not take the shifting into account. If all
bit combinations are equally likely, 50% of the cases will only need
one comparison, and the average number of comparisons will be just
below 2. (I think your numbers assume that only one bit is set at a
time.)
> Cleanup of FormatableBitSet
> ---------------------------
>
> Key: DERBY-2191
> URL: https://issues.apache.org/jira/browse/DERBY-2191
> Project: Derby
> Issue Type: Improvement
> Components: Miscellaneous
> Affects Versions: 10.2.1.6
> Reporter: Dyre Tjeldvoll
> Assigned To: Dyre Tjeldvoll
> Priority: Trivial
> Fix For: 10.3.0.0
>
> Attachments: anysetbit.v1.diff, anysetbit.v1.stat, anysetbit.v2.diff,
> bitops.v1.diff, bitops.v1.stat, bitops.v2.diff, bitops.v2.stat,
> bitops.v3.diff, bitopt.v1.diff, bitopt.v1.stat, bitopt.v2.diff,
> boundarycheck.v1.diff, boundarycheck.v1.stat, cleanup2191.diff,
> cleanup2191.stat, deadcode.v1.diff, deadcode.v2.diff, fbstst.v1.diff,
> fbstst.v1.stat, FormatableBitSetTest.java, numbitsset.v1.diff,
> numbitsset.v1.stat, unusedmethods.v1.diff, unusedmethods.v1.stat,
> valuenotnull.v1.diff, valuenotnull.v1.stat
>
>
> The implementation of FormatableBitSet could be streamlined. Dead code can be
> removed and the implementation of some methods can be simplified.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.