> This PR proposes adding a new method to BitSet that provides an immutable 
> snapshot of the set in the form of an `IntPredicate`.
> 
> The predicate is eligible for constant folding.
> 
> Here are some classes in the JDK that would benefit directly from 
> constant-folding of BitSets:
> 
> PoolReader (6)
> URLEncoder (1) - Updated in this PR
> HtmlTree (2)
> 
> More over, the implementation of the predicate is @ValueBased and this would 
> provide additional benefits in the future.
> 
> Initial benchmarks with the URLEncoder show encouraging results:
> 
> 
> Name                           (encodeChars) (maxLength) (unchanged) Cnt  
> Base   Error   Test   Error  Unit  Diff%
> URLEncodeDecode.testEncodeUTF8             6        1024           0  15 
> 2,371 ± 0,016  2,073 ± 0,184 ms/op  12,6% (p = 0,000*)
> URLEncodeDecode.testEncodeUTF8             6        1024          75  15 
> 1,772 ± 0,013  1,387 ± 0,032 ms/op  21,8% (p = 0,000*)
> URLEncodeDecode.testEncodeUTF8             6        1024         100  15 
> 1,230 ± 0,009  1,140 ± 0,011 ms/op   7,3% (p = 0,000*)

Per Minborg has updated the pull request incrementally with two additional 
commits since the last revision:

 - Update test/jdk/java/util/BitSet/ImmutableBitSet.java
   
   Co-authored-by: Claes Redestad <claes.redes...@oracle.com>
 - Remove factory check and add copyright message

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/15530/files
  - new: https://git.openjdk.org/jdk/pull/15530/files/6f80e0b6..80b5aacf

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15530&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15530&range=03-04

  Stats: 32 lines in 2 files changed: 25 ins; 6 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15530.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15530/head:pull/15530

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

Reply via email to