> Please review this performance fix.
> 
> For reference arrays, `ArrayType.newInstance()` searches all loaded classes 
> for the component class, which can be slow when many classes are loaded.
> 
> **Fix:**
> 
> Search the array's class loader first, with the global lookup as a fallback. 
> Hidden classes continue to use the global lookup.
> 
> **Testing:**
> 
> - Added hidden-class and `int[][]` coverage to `NewInstanceTest`.
> - `com/sun/jdi`: 191 passed (1 excluded by the existing ProblemList)
> - `vmTestbase/nsk/jdi`: 1143 passed (including 2 skips for a transport 
> unsupported)
> - `vmTestbase/nsk/jdwp`: 114 passed (1 excluded by the existing ProblemList)
> - `vmTestbase/nsk/jdb`: 68 passed
> - Local JDI `Object[]` measurement with 70,000 additional classes: **17.27 
> ms/call -> 0.156 ms/call**.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Yunbo Zhang has updated the pull request incrementally with one additional 
commit since the last revision:

  8343851: Slow new array creation in case of many classes loaded

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/33414/files
  - new: https://git.openjdk.org/jdk/pull/33414/files/01144311..b5f8e807

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=33414&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33414&range=00-01

  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/33414.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33414/head:pull/33414

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

Reply via email to