<i18n dev> Integrated: 8302877: Speed up latin1 case conversions

Eirik Bjorsnos duke at openjdk.org
Tue Feb 21 20:57:43 UTC 2023


On Fri, 17 Feb 2023 17:31:09 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:

> This PR suggests we speed up Character.toUpperCase and Character.toLowerCase for latin1 code points by applying the 'oldest ASCII trick in the book'.
> 
> This takes advantage of the fact that latin1 uppercase code points are always 0x20 lower than their lowercase (with the exception of two code points which uppercase out of latin1).
> 
> To verify the correctness of the new implementation, the test `Latin1CaseConversion` is added with an exhaustive verification of toUpperCase/toLowerCase for all latin1 code points.
> 
> The implementation needs to balance the performance of the various ranges in latin1. An effort has been made to favour operations on ASCII code points, without causing excessive regression for higher code points.
> 
> Performance is benchmarked for 7 chosen sample code points, each representing a range or a special-case.  Results in the first comment.

This pull request has now been integrated.

Changeset: ef1f7bd3
Author:    Eirik Bjorsnos <eirbjo at gmail.com>
Committer: Naoto Sato <naoto at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ef1f7bd3b80f8777c15ab22b1dff7dfe4f084734
Stats:     166 lines in 5 files changed: 143 ins; 0 del; 23 mod

8302877: Speed up latin1 case conversions

Reviewed-by: naoto, redestad

-------------

PR: https://git.openjdk.org/jdk/pull/12623


More information about the i18n-dev mailing list