RFR: 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable [v2]
Сергей Цыпанов
github.com+10835776+stsypanov at openjdk.java.net
Tue Aug 10 21:06:00 UTC 2021
> The code in `Integer.decode()` and `Long.decode()` might allocate two instances of Integer/Long for the negative values less than -127:
>
> Integer result;
>
> result = Integer.valueOf(nm.substring(index), radix);
> result = negative ? Integer.valueOf(-result.intValue()) : result;
>
> To avoid this we can declare 'result' as `int` and use `Integer.parseInt()` method. Same applicable for `Long` and some other classes.
Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
- 8267844: Add benchmarks for Integer/Long.decode()
- 8267844: Rid useless substring when calling Integer/Long.parse*()
- Merge branch 'master' into 8267844
- Merge branch 'master' into 8267844
- 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/5068/files
- new: https://git.openjdk.java.net/jdk/pull/5068/files/a1b993d4..7486b13f
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5068&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5068&range=00-01
Stats: 149574 lines in 2453 files changed: 97455 ins; 39648 del; 12471 mod
Patch: https://git.openjdk.java.net/jdk/pull/5068.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5068/head:pull/5068
PR: https://git.openjdk.java.net/jdk/pull/5068
More information about the security-dev
mailing list