[pgjdbc/pgjdbc] c84e62: Utf 8 encoding optimizations (#1444)

From: Brett Okken <noreply(at)github(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: [pgjdbc/pgjdbc] c84e62: Utf 8 encoding optimizations (#1444)
Date: 2020-01-16 16:13:26
Message-ID: pgjdbc/pgjdbc/push/refs/heads/master/2972ad-c84e62@github.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: c84e62efa5b98323562753e45fbf0d974eaca483
https://github.com/pgjdbc/pgjdbc/commit/c84e62efa5b98323562753e45fbf0d974eaca483
Author: Brett Okken <brett(dot)okken(dot)os(at)gmail(dot)com>
Date: 2020-01-16 (Thu, 16 Jan 2020)

Changed paths:
A pgjdbc/src/main/java/org/postgresql/core/ByteOptimizedUTF8Encoder.java
A pgjdbc/src/main/java/org/postgresql/core/CharOptimizedUTF8Encoder.java
M pgjdbc/src/main/java/org/postgresql/core/Encoding.java
A pgjdbc/src/main/java/org/postgresql/core/OptimizedUTF8Encoder.java
R pgjdbc/src/main/java/org/postgresql/core/UTF8Encoding.java
A pgjdbc/src/test/java/org/postgresql/core/UTF8EncodingTest.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java

Log Message:
-----------
Utf 8 encoding optimizations (#1444)

* fix: Correct typo weather to whether

* misc: Change internal Encoding.testAsciiNumbers(...) to be static

* perf: Enhance Encoding constructor to allow skipping of ASCII number compatibility test

Adds a two parameter constructor to Encoding to allow sub classes to specify whether their
known ASCII compatability so as to skip testing. The only usage of it is the UTF8Encoding
which is changed to use the new constructor.

* fix: limit size of char[] for utf-8 decoding

Also optimize for java 9+ byte[] backed strings

* fix: limit size of char[] for utf-8 decoding

address style issues

* fix: limit size of char[] for utf-8 decoding

address style issues

* fix: limit size of char[] for utf-8 decoding

use existing JavaVersion enum to pick implementation
add unit test string values
more consistency between byte and char based implementations

* fix: limit size of char[] for utf-8 decoding

fix backwards comparison
add more strings to unit test

* fix: limit size of char[] for utf-8 decoding

Move to using new String(byte[], int, int, Charset) rather than custom
decoding for jre newer than 1.8.

* fix: limit size of char[] for utf-8 decoding

Back to custom utf-8 decoding for performance gains while validating

* javadoc

* put test back into test suite

* avoid creating an unnecessary `char[]` when growing cached array

Co-authored-by: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Co-authored-by: Dave Cramer <davecramer(at)gmail(dot)com>

Browse pgsql-jdbc by date

  From Date Subject
Next Message bjanczak 2020-01-20 10:34:57 [pgjdbc/pgjdbc] c57414: Metadata queries improvements. (#1673)
Previous Message Andreas Joseph Krogh 2020-01-10 17:36:06 Re: Plans to implement ResultSet.getObject(String columnLabel, java.util.Map<String,Class<?>> map) ?