Description
At http://hg.openjdk.java.net/jdk/jdk/file/ddfb658c8ce3/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c#l105, `createBoolean(JNIEnv * env, int b)` creates a new `Boolean` each time it is called, though it can only return `Boolean.FALSE` or `Boolean.TRUE`.
Rather than allocating (and requiring the collection of) a new instance from each call, it could call `Boolean.valueOf(b != 0)`.
The same might be true for the corresponding `createInteger` function, though I do not know the range of the `int`s that might be wrapped. But that choice should be left to `Integer.valueOf(int)`.
The same inefficiencies exist over in http://hg.openjdk.java.net/jdk/jdk/file/ddfb658c8ce3/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c#l94. And it might exist elsewhere.
Rather than allocating (and requiring the collection of) a new instance from each call, it could call `Boolean.valueOf(b != 0)`.
The same might be true for the corresponding `createInteger` function, though I do not know the range of the `int`s that might be wrapped. But that choice should be left to `Integer.valueOf(int)`.
The same inefficiencies exist over in http://hg.openjdk.java.net/jdk/jdk/file/ddfb658c8ce3/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c#l94. And it might exist elsewhere.
Attachments
Issue Links
- relates to
-
JDK-8253119 Remove the legacy PlainSocketImpl and PlainDatagramSocketImpl implementation
-
- Resolved
-