On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
> In the current implementation of `String.join(CharSequence, Iterable)`, the
> temp array `elems` is always initialized with a length of 8. It will cause
> many array recreations when the `Iterable` contains more than 8 elements.
> Furthermore, it's very common that an `Iterable` is also a `Col
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Mon, 10 Apr 2023 05:19:05 GMT, Glavo wrote:
>> @yuantj As I mentioned earlier, we need to prevent errors from leaking to
>> other places, rather than defending against all errors.
>
>> @Glavo Then why doesn't `ArrayList` trust `toArray()`? If all
>> implementations behave correctly, then it
On Mon, 10 Apr 2023 05:14:16 GMT, Glavo wrote:
>> @Glavo Then why doesn't `ArrayList` trust `toArray()`? If all
>> implementations behave correctly, then it should return an `Object[]`
>> independent of the original collection, so `ArrayList` should trust it.
>> Those who doesn't implement `to
On Mon, 10 Apr 2023 05:12:07 GMT, Tingjun Yuan wrote:
>> If you really don't trust a collection, then we can't do anything.
>>
>> Can copying the results of `toArray` ensure accuracy and security? It has
>> too many possible problems. Maybe the size of the array is wrong, maybe it
>> forgot to
On Mon, 10 Apr 2023 04:57:09 GMT, Glavo wrote:
>> Tingjun Yuan has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Add benchmark
>
> If you really don't trust a collection, then we can't do anything.
>
> Can copying the results of `toArray`
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Mon, 10 Apr 2023 04:28:34 GMT, Chen Liang wrote:
>> Nah. I mean like:
>>
>> public static String join(CharSequence delimiter,
>> Iterable elements) {
>> Objects.requireNonNull(delimiter);
>> Objects.requireNonNull(elements);
>> var delim = delimiter.toS
On Mon, 10 Apr 2023 04:28:34 GMT, Chen Liang wrote:
> nobody actually trusts this contract
I guess not every place should not trust this contract.
Where should we distrust contracts and use defensive programming? For example,
the constructor of `ArrayList` that accepts `Collection` should not
On Mon, 10 Apr 2023 03:36:44 GMT, Chen Liang wrote:
>> Tingjun Yuan has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Add benchmark
>
> Nah. I mean like:
>
> public static String join(CharSequence delimiter,
> Iterable ele
On Mon, 10 Apr 2023 03:36:44 GMT, Chen Liang wrote:
>> Tingjun Yuan has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Add benchmark
>
> Nah. I mean like:
>
> public static String join(CharSequence delimiter,
> Iterable ele
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
On Mon, 10 Apr 2023 03:04:20 GMT, Chen Liang wrote:
>> @liach Working on that.
>
> @yuantj Alternatively, you can probably try working on the `toArray` result
> of a collection than to allocate a new String array. This might be more
> efficient for some implementations like ArrayList as well, i
On Sun, 9 Apr 2023 02:37:45 GMT, Tingjun Yuan wrote:
>> This appears to be a 4% improvement for non-concurrent structures like
>> ArrayList or LinkedHashSet, if we ignore the baseline difference (for
>> Iterable). This is anticipated as the growth of array size is exponential,
>> so the total
On Sun, 9 Apr 2023 02:37:45 GMT, Tingjun Yuan wrote:
>> This appears to be a 4% improvement for non-concurrent structures like
>> ArrayList or LinkedHashSet, if we ignore the baseline difference (for
>> Iterable). This is anticipated as the growth of array size is exponential,
>> so the total
`Pattern.namedGroups` and `Matcher.namedGroups` contains only non-null values.
It means instead of separate `containsKey`+`get` calls, we can use single
`HashMap.get` call and then compare result with null.
Result code is a bit simpler and faster.
-
Commit messages:
- 8305785: Avoi
Hi,
We discussed this issue on this mailing list[1] earlier this year.
I investigated the usage of these two methods and found that all use cases
within
JDK are suspicious, resulting in many imperceptible bugs.
I hope to create a PR for this issue, deprecate these two methods, and
create
alterna
Hello,
could you please add String & Character ASCII case conversion methods, that is,
methods which only perform case conversion on ASCII characters in the input and
leave any other characters unchanged. The conversion should not depend on the
default locale. For example:
- String:
- toAsciiL
On Mon, 3 Apr 2023 17:16:26 GMT, Andrey Turbanov wrote:
> `LinkedHashMap` `ZipFileSystem.inodes` contains only
> non-null values. It means instead of separate `containsKey`+`get` calls, we
> can use single `LinkedHashMap.get` call and then compare result with `null`.
> Result code is a bit simp
On Mon, 3 Apr 2023 17:16:26 GMT, Andrey Turbanov wrote:
> `LinkedHashMap` `ZipFileSystem.inodes` contains only
> non-null values. It means instead of separate `containsKey`+`get` calls, we
> can use single `LinkedHashMap.get` call and then compare result with `null`.
> Result code is a bit simp
On Fri, 7 Apr 2023 07:47:49 GMT, Eirik Bjorsnos wrote:
>> This PR removes the JAR index feature from the runtime:
>>
>> - `URLClassPath` is updated to remove the `enableJarIndex` system property
>> and any code which would be called when this property was `true`
>> - The `JarIndex` implementat
On Sun, 9 Apr 2023 02:28:37 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Furt
27 matches
Mail list logo