Describe the issue
Currently, GSSInputStream makes a number of allocations for every read call.
In fact, we know backend never produces messages that exceed 16KiB, so we could use 16KiB buffer in case of GSS connection, and GSSInputStream could peek into VisibleBufferedInputStream's buffer.
The following allocations could be removed:
|
byte[] int4Buf = new byte[4]; |
|
byte[] encryptedBuffer = new byte[encryptedLength]; |
Describe the issue
Currently,
GSSInputStreammakes a number of allocations for every read call.In fact, we know backend never produces messages that exceed 16KiB, so we could use 16KiB buffer in case of GSS connection, and
GSSInputStreamcould peek intoVisibleBufferedInputStream'sbuffer.The following allocations could be removed:
pgjdbc/pgjdbc/src/main/java/org/postgresql/gss/GSSInputStream.java
Line 39 in 450488c
pgjdbc/pgjdbc/src/main/java/org/postgresql/gss/GSSInputStream.java
Line 54 in 450488c