I wouldn't worry too much about over 2^29 either.
However, the number of possible valid language tags is much larger than
people think, since any combination of multiple variants can occur). So
even not counting the locale extensions, it is over 2^129 (my rough
calculation).
Mark
On Tue, May 5,
Hi Stuart,
On 5/5/20 4:29 PM, Stuart Marks wrote:
As for Naoto's changeset, I don't think it should be held up while we
bikeshed this. :-) I'm ok with whatever he decides.
I don't think the number of language tags exceed 2^29, unless languages
in the whole universe are counted :-) So I would
Hm, interesting, good catch Peter! Very subtle. The time-honored
(int) (expected / 0.75f) + 1
appears in several places around the JDK. I think most people (including me)
just copy it, because it's "good enough" for most cases.
I'm a little concerned about
(expectedSize * 4 + 2) / 3
On 5/5/2020 2:08 PM, naoto.s...@oracle.com wrote:
Thanks, all. I didn't see this coming!
+1, just when one might think it was just a minor tweak... ;-)
If I understand the discussion correctly, Peter's suggestion is the
most optimal (Mark, your formula produces 1 for the expected size is
Thanks, all. I didn't see this coming!
If I understand the discussion correctly, Peter's suggestion is the most
optimal (Mark, your formula produces 1 for the expected size is 0,
although it won't be happening in this particular case). And Joe, thank
you for finding my silly mistake :-) So her
On 5/5/20 8:29 PM, Joe Wang wrote:
Hi Naoto,
It seems you've missed the parentheses in :
Set tagset = new HashSet<>(tokens.countTokens() * 4 + 2 / 3);
vs
Set tagset = new HashSet<>((tokens.countTokens() * 4 + 2) / 3);
-Joe
Just a reminder to Naoto: In all this excitement, don't loose track
There's more...
Guava (and JDK in copy constructor) formula:
(int) ((float) expectedSize / 0.75f + 1.0f)
is not the same as Naoto's formula:
(int) (expectedSize / 0.75f) + 1
Notice that Naoto does addition of 1 in integer arithmetic after
conversion to int, while Guava/JDK does in
On 5/5/20 9:41 PM, Martin Buchholz wrote:
Hi Peter,
Are you saying guava has a tiny bug?
If it was just 1 too much when expected size is a multiple of 3 then
that would not be a bug, just sub-optimal calculation. And the same
calculation is performed also in JDK when a copy constructor is
Hi Peter,
Are you saying guava has a tiny bug?
On Tue, May 5, 2020 at 12:12 PM Peter Levart wrote:
> Hi Martin,
> On 5/5/20 8:26 PM, Martin Buchholz wrote:
>
> See related:
>
> https://guava.dev/releases/23.0/api/docs/com/google/common/collect/Maps.html#newHashMapWithExpectedSize-int-
>
>
> Thi
Hi Martin,
On 5/5/20 8:26 PM, Martin Buchholz wrote:
See related:
https://guava.dev/releases/23.0/api/docs/com/google/common/collect/Maps.html#newHashMapWithExpectedSize-int-
This is basically the same calculation (or at least gives same result)
as Naoto did (without the max part):
Naoto:
> (int)(tokens.countTokens() / 0.75f) + 1
> (tokens.countTokens() * 4 + 2) / 3
if you want A * X / Y, rounded up, you can use (A * X - 1 ) / Y + 1
eg where X/Y = 4/3,
0 => 0
1 => 2
2 => 3
3 => 4
4 => 6
...
Mark
On Tue, May 5, 2020 at 9:48 AM Peter Levart wrote:
> Hi Naoto,
>
> On 4/30/20 1
Hi Naoto,
It seems you've missed the parentheses in :
Set tagset = new HashSet<>(tokens.countTokens() * 4 + 2 / 3);
vs
Set tagset = new HashSet<>((tokens.countTokens() * 4 + 2) / 3);
-Joe
On 5/5/2020 11:01 AM, naoto.s...@oracle.com wrote:
And here is the fix. Please review.
http://cr.openjdk.
See related:
https://guava.dev/releases/23.0/api/docs/com/google/common/collect/Maps.html#newHashMapWithExpectedSize-int-
On Tue, May 5, 2020 at 11:03 AM wrote:
> And here is the fix. Please review.
>
> http://cr.openjdk.java.net/~naoto/8244459/webrev.00/
>
> Naoto
>
> On 5/5/20 10:25 AM, naoto.
And here is the fix. Please review.
http://cr.openjdk.java.net/~naoto/8244459/webrev.00/
Naoto
On 5/5/20 10:25 AM, naoto.s...@oracle.com wrote:
Hi Peter,
You are correct. Thanks. I'll remove that initial value of 16.
Naoto
On 5/5/20 9:37 AM, Peter Levart wrote:
Hi Naoto,
On 4/30/20 12:18
Hi Peter,
You are correct. Thanks. I'll remove that initial value of 16.
Naoto
On 5/5/20 9:37 AM, Peter Levart wrote:
Hi Naoto,
On 4/30/20 12:18 AM, naoto.s...@oracle.com wrote:
Hello,
Please review this small fix to the following issue:
https://bugs.openjdk.java.net/browse/JDK-8244152
Th
Hi Naoto,
On 4/30/20 12:18 AM, naoto.s...@oracle.com wrote:
Hello,
Please review this small fix to the following issue:
https://bugs.openjdk.java.net/browse/JDK-8244152
The proposed changeset is located at:
https://cr.openjdk.java.net/~naoto/8244152/webrev.00/
The hash map used there didn't
16 matches
Mail list logo