we might start from some small, uncontroversial, and low-risk gains. For
example, I would consider resetting StringBuilder coder to LATIN1 upon
setLength(0) as a small gain with lower risk, though it does not directly
relate to this effort of speeding up the write buffering.
Chen
On Sun, J
improved by about 30%~70% in UTF8. The
performance of non-UTF8 encodings is the same as before.
```sh
git remote add wenshao g...@github.com:wenshao/jdk.git
git fetch wenshao
#baseline
git checkout 2758d6ad7767832db004d28f10cc764f33fa438e
make test TEST="micro:java.io.BufferedWriterBench" MICR
va.base/share/classes/java/io/OutputStreamWriter.java#L45
<https://github.com/openjdk/jdk/blob/4dd1b3a6100f9e379c7cee3c699d63d0d01144a7/src/java.base/share/classes/java/io/OutputStreamWriter.java#L45
>
On Sun, Jun 29, 2025 at 11:04 AM wenshao mailto:shaojin.we...@alibaba-
BufferedWriter -> OutputStreamWriter -> StreamEncoder
In this call chain, BufferedWriter has a char[] buffer, and StreamEncoder has a
ByteBuffer. There are two layers of cache here, or the BufferedWriter layer can
be removed.
LATIN1 (byte[]) -> UTF16 (char[]) -> UTF8 (byte[])
And when charset is
Some final arrays of BigInteger and BigDecimal are stable and immutable. We
should add `@Stable` to give the optimizer more information
-
Shaojin Wen
Some static final arrays of BigInteger and BigDecimal are stable and immutable.
We should add @Stable to give the optimizer more information
-
Shaojin Wen
Classes such as java.lang.CharacterDataXXX have multiple static final arrays,
which will not be modified. We should add @Stable to provide information to the
optimizer.
such as
```java
class CharacterData00 {
@Stable static final char[] X =
@Stable static final char[] Y =
@Stable static final int
Now Integer/Long uses Integer::digits to convert to byte, so we should define
Integer::digits as byte[], which can avoid the conversion.
-
Shaojin Wen
When debugging getLong/getDouble/getDecimal of java.text.DigitList, the
debugger will call the DigitList::toString method. At this time,
DigitList::toString will modify tempBuilder, which will cause incorrect results.
-
Shaojin Wen
Through JVM Option +PrintInlining, we found that String has a constructor
codeSize of 852, which is too large. This caused failed to inline.
The following is the output information of PrintInlining:
```
@ 9 java.lang.String:: (12 bytes) inline (hot)
!m @ 1 java.nio.charset.Charset::defaultCharset
As the author of a popular json library (fastjson/fastjson2), I think the
current design is not good, not easy to use, and the performance is not good.
The JsonNull/JsonNumber/JsonString/JsonValue here should not be designed like
this, which will cause trouble to users and affect performance.
For
Many libraries use Unsafe to improve performance, especially in many
performance-critical scenarios of big data, such as Apache Flink/Apache Arrow,
etc. Direct removal will make it difficult to adopt the new version of JDK.
It is recommended to use it similar to JEP 396, which needs to be opened
12 matches
Mail list logo