On 11/30/18 8:34 PM, Zheka Kozlov wrote:
I think we should choose Tagir's version so you don't need my OCA.
OK, thanks. Let me know if you need any assistance with the OCA, should you
decide to proceed with it.
s'marks
Hello, Ivan!
> The check
> if (((n << i) & 0x8000_) != 0) {
> might be written as
> if ((n << i) < 0 ) {
> to save one bit-wise operation and avoid using extra constant.
Nice catch, thanks! When I switch my mind to bitwise thinking mode, I
forget about normal arithmetic properties
Thanks, Stuart, Martin. I've created an issue and posted a webrev here:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-December/057038.html
> You're optimizing hashCode to be O(log(N)) instead of O(N)?
Yes.
On Sat, Dec 1, 2018 at 6:38 AM Stuart Marks wrote:
>
>
>
> On 11/30/18 8:52
I think we should choose Tagir's version so you don't need my OCA.
сб, 1 дек. 2018 г. в 06:38, Stuart Marks :
>
>
> On 11/30/18 8:52 AM, Martin Buchholz wrote:
> > On Thu, Nov 29, 2018 at 8:02 PM, Tagir Valeev wrote:
> >
> >> I can file an issue and create a webrev, but I still need a sponsor
>
On 11/30/18 8:52 AM, Martin Buchholz wrote:
On Thu, Nov 29, 2018 at 8:02 PM, Tagir Valeev wrote:
I can file an issue and create a webrev, but I still need a sponsor
and review for such change. Martin, can you help with this?
As usual, I'm only half paying attention, but I can be your
On Thu, Nov 29, 2018 at 8:02 PM, Tagir Valeev wrote:
>
> I can file an issue and create a webrev, but I still need a sponsor
> and review for such change. Martin, can you help with this?
>
As usual, I'm only half paying attention, but I can be your shepherd.
You're optimizing hashCode to be
> If n == 1, then it would become `mask = n << 32`, and the loop would
run 32 times.
Forget my implementation. It is incorrect at all. In only works for odd
numbers :(
пт, 30 нояб. 2018 г. в 13:58, Ivan Gerasimov :
> Hi Zheka and Tagir!
>
>
> On 11/29/18 10:37 PM, Zheka Kozlov wrote:
> >
Hi Zheka and Tagir!
On 11/29/18 10:37 PM, Zheka Kozlov wrote:
Thanks, Tagir!
I was also thinking of how to calculate hashCode quickly but my direction
was wrong. I thought that we can use the formula of the sum of a geometric
progression: Sum(p^k, k = 0..n) = (1-p^n)/(1-p). Unfortunately,
Thanks, Tagir!
I was also thinking of how to calculate hashCode quickly but my direction
was wrong. I thought that we can use the formula of the sum of a geometric
progression: Sum(p^k, k = 0..n) = (1-p^n)/(1-p). Unfortunately, this
involves division which doesn't work with the overflow of
Hello!
If you are doing it fast, why not doing it really fast? If you
deparenthesize and regroup terms, you'll got
h(e, n) = p ^ n + e * f(n)
Where h(e, n) is the hashCode of n elements with hashCode of single
element = e; p = 31 and
f(n) = Sum(p^k, k = 0..n-1)
Using simple algebraic rules,
I agree!
(but don't have time ...)
On Sun, Nov 25, 2018 at 9:01 PM, Zheka Kozlov wrote:
> Currently, CopiesList.hashCode() is inherited from AbstractList which:
>
>- calls hashCode() for each element,
>- creates a new Iterator every time.
>
> However, for Collections.nCopies():
>
>
11 matches
Mail list logo