From duke at openjdk.java.net Mon Nov 8 12:45:49 2021 From: duke at openjdk.java.net (Vsevolod Tolstopyatov) Date: Mon, 8 Nov 2021 12:45:49 GMT Subject: RFR: [DRAFT] Support Java literals in @Param annotation In-Reply-To: References: Message-ID: <0ZeKOHcX_l25skxfOZhU31prjjhH3Pec8etTJtedgd4=.39e124ff-6adc-42e0-b1d7-20a91bc075f4@github.com> On Thu, 9 Sep 2021 16:27:44 GMT, Vsevolod Tolstopyatov wrote: > This is a follow-up to https://mail.openjdk.java.net/pipermail/jmh-dev/2020-October/003039.html > > I've prototyped it and found few corners which I'd like to highlight and discuss. > > The initial purpose of the change is to be able to use underscores for the sake of better readability in both code and text reports: > > `@Param("1_000", "10_000", "100_000")` > > and > > > Benchmark (listSize) Mode Cnt Score Error Units > ShowOff.consume 1_000 thrpt 42294.795 ops/s > ShowOff.consume 10_000 thrpt 4057.322 ops/s > ShowOff.consume 100_000 thrpt 2866.069 ops/s > > > > While doing so, I've decided that it would be nice to support the strict subset of actual Java literals (at least to have a reference to point at) which has a lot of pitfalls: > > * Now we have (?) to support octal, binary and hexadecimal literals > * The actual grammar is quite wild, so literals like `0_12___3_4` are also supported > * `l` and `L` at the end of `long` literals are not supported (it seems a bit weird to do so) > * `NumericLiteralsParser` leaks to public API, so the generated benchmarks can invoke it (not sure what's the API policy here, but it's worth pointing it out) > * Underscores in floating points literals are not supported, mostly because then I have to match hexadecimal literals with underscores as well. No particular reason apart from "it's extra work without clear benefits". I can implement it if it's required for the PR though. > > Most importantly, support of such literals will break existing benchmarks that prefixed their numeric parameters with zero -- now they are interpreted as octal literals (and either rejected, e.g. `09` or converted to decimal, breaking the original authors intent). Previously, `X.parseX` functions (e.g. `Integer.parseInt`) were used and they are okay with leading zeroes. > > Breaking change seems to be the blocker here, and I'd like to hear your opinion of the acceptable approach aligned with JMH API > > Potential alternatives: > > * Do nothing, don't support underscores > * Support only decimal literals > * Support any subset of literals (e.g. decimal and hexadecimal only) > * Just trim all the underscores and parse it as before via `Integer.parseInt` and so on Hi, friendly reminder in case you've accidentally missed it or interpreted `[DRAFT]` prefix as "not yet ready for discussion". It would be nice to hear the maintainer's opinion on the proposed alternatives. ------------- PR: https://git.openjdk.java.net/jmh/pull/50 From ngasson at openjdk.java.net Thu Nov 11 03:20:07 2021 From: ngasson at openjdk.java.net (Nick Gasson) Date: Thu, 11 Nov 2021 03:20:07 GMT Subject: RFR: CODETOOLS-7903056: perfasm can report wrong stub name Message-ID: This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. Example of the new output, where previously the `` line reported the wrong stub routine: 18.19% libjvm.so ProgrammableUpcallHandler::on_entry 13.94% 9.39% libjvm.so ProgrammableUpcallHandler::on_exit 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 ------------- Commit messages: - CODETOOLS-7903056: perfasm can report wrong stub name Changes: https://git.openjdk.java.net/jmh/pull/54/files Webrev: https://webrevs.openjdk.java.net/?repo=jmh&pr=54&range=00 Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7903056 Stats: 26 lines in 1 file changed: 20 ins; 0 del; 6 mod Patch: https://git.openjdk.java.net/jmh/pull/54.diff Fetch: git fetch https://git.openjdk.java.net/jmh pull/54/head:pull/54 PR: https://git.openjdk.java.net/jmh/pull/54 From shade at openjdk.java.net Thu Nov 11 07:03:51 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Thu, 11 Nov 2021 07:03:51 GMT Subject: RFR: CODETOOLS-7903056: perfasm can report wrong stub name In-Reply-To: References: Message-ID: On Thu, 11 Nov 2021 03:14:36 GMT, Nick Gasson wrote: > This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. > > Example of the new output, where previously the `` line reported the wrong stub routine: > > > 18.19% libjvm.so ProgrammableUpcallHandler::on_entry > 13.94% > 9.39% libjvm.so ProgrammableUpcallHandler::on_exit > 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 Changes requested by shade (Committer). jmh-core/src/main/java/org/openjdk/jmh/util/IntervalMap.java line 42: > 40: @Override > 41: public int compareTo(Interval other) { > 42: return (int)(this.from - other.from); Suggestion: return Long.compare(this.from, other.from); ------------- PR: https://git.openjdk.java.net/jmh/pull/54 From shade at openjdk.java.net Thu Nov 11 07:03:52 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Thu, 11 Nov 2021 07:03:52 GMT Subject: RFR: CODETOOLS-7903056: perfasm can report wrong stub name In-Reply-To: References: Message-ID: On Thu, 11 Nov 2021 06:57:37 GMT, Aleksey Shipilev wrote: >> This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. >> >> Example of the new output, where previously the `` line reported the wrong stub routine: >> >> >> 18.19% libjvm.so ProgrammableUpcallHandler::on_entry >> 13.94% >> 9.39% libjvm.so ProgrammableUpcallHandler::on_exit >> 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 > > jmh-core/src/main/java/org/openjdk/jmh/util/IntervalMap.java line 42: > >> 40: @Override >> 41: public int compareTo(Interval other) { >> 42: return (int)(this.from - other.from); > > Suggestion: > > return Long.compare(this.from, other.from); I also believe the Java style requires `equals` and `hashCode` that is coherent with newly added `compareTo`. Please autogenerate one in IDE, using `from` field? ------------- PR: https://git.openjdk.java.net/jmh/pull/54 From ngasson at openjdk.java.net Thu Nov 11 07:48:13 2021 From: ngasson at openjdk.java.net (Nick Gasson) Date: Thu, 11 Nov 2021 07:48:13 GMT Subject: RFR: CODETOOLS-7903056: perfasm can report wrong stub name [v2] In-Reply-To: References: Message-ID: > This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. > > Example of the new output, where previously the `` line reported the wrong stub routine: > > > 18.19% libjvm.so ProgrammableUpcallHandler::on_entry > 13.94% > 9.39% libjvm.so ProgrammableUpcallHandler::on_exit > 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 Nick Gasson has updated the pull request incrementally with one additional commit since the last revision: Address review comments ------------- Changes: - all: https://git.openjdk.java.net/jmh/pull/54/files - new: https://git.openjdk.java.net/jmh/pull/54/files/cfa2440f..a61524e1 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jmh&pr=54&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jmh&pr=54&range=00-01 Stats: 27 lines in 1 file changed: 26 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jmh/pull/54.diff Fetch: git fetch https://git.openjdk.java.net/jmh pull/54/head:pull/54 PR: https://git.openjdk.java.net/jmh/pull/54 From shade at openjdk.java.net Thu Nov 11 07:48:15 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Thu, 11 Nov 2021 07:48:15 GMT Subject: RFR: CODETOOLS-7903056: perfasm can report wrong stub name [v2] In-Reply-To: References: Message-ID: On Thu, 11 Nov 2021 07:44:45 GMT, Nick Gasson wrote: >> This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. >> >> Example of the new output, where previously the `` line reported the wrong stub routine: >> >> >> 18.19% libjvm.so ProgrammableUpcallHandler::on_entry >> 13.94% >> 9.39% libjvm.so ProgrammableUpcallHandler::on_exit >> 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 > > Nick Gasson has updated the pull request incrementally with one additional commit since the last revision: > > Address review comments Looks fine, thanks. ------------- Marked as reviewed by shade (Committer). PR: https://git.openjdk.java.net/jmh/pull/54 From ngasson at openjdk.java.net Thu Nov 11 10:17:53 2021 From: ngasson at openjdk.java.net (Nick Gasson) Date: Thu, 11 Nov 2021 10:17:53 GMT Subject: Integrated: CODETOOLS-7903056: perfasm can report wrong stub name In-Reply-To: References: Message-ID: On Thu, 11 Nov 2021 03:14:36 GMT, Nick Gasson wrote: > This patch changes `IntervalMap::get` to check that the value falls within an interval's high/low bounds. Otherwise it returns the closest entry < value which can be misleading. > > Example of the new output, where previously the `` line reported the wrong stub routine: > > > 18.19% libjvm.so ProgrammableUpcallHandler::on_entry > 13.94% > 9.39% libjvm.so ProgrammableUpcallHandler::on_exit > 8.36% c2, level 4 java.lang.invoke.LambdaForm$MH.0x00000008001b8400::invoke, version 1595 This pull request has now been integrated. Changeset: 25860b32 Author: Nick Gasson Committer: Aleksey Shipilev URL: https://git.openjdk.java.net/jmh/commit/25860b326dd681f4442124d64b2f75aa31cb70ba Stats: 52 lines in 1 file changed: 46 ins; 0 del; 6 mod 7903056: perfasm can report wrong stub name Reviewed-by: shade ------------- PR: https://git.openjdk.java.net/jmh/pull/54 From shade at openjdk.java.net Tue Nov 30 10:10:37 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 30 Nov 2021 10:10:37 GMT Subject: RFR: CODETOOLS-7903068: JMH: Enable compiler blackholes by default, if available Message-ID: With the release of JDK 17, we can finally consider enabling [compiler blackholes](https://shipilev.net/jvm/anatomy-quarks/27-compiler-blackholes/) by default. ------------- Commit messages: - Fix Changes: https://git.openjdk.java.net/jmh/pull/57/files Webrev: https://webrevs.openjdk.java.net/?repo=jmh&pr=57&range=00 Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7903068 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jmh/pull/57.diff Fetch: git fetch https://git.openjdk.java.net/jmh pull/57/head:pull/57 PR: https://git.openjdk.java.net/jmh/pull/57 From shade at openjdk.java.net Tue Nov 30 10:33:22 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 30 Nov 2021 10:33:22 GMT Subject: RFR: [DRAFT] Support Java literals in @Param annotation In-Reply-To: References: Message-ID: On Thu, 9 Sep 2021 16:27:44 GMT, Vsevolod Tolstopyatov wrote: > This is a follow-up to https://mail.openjdk.java.net/pipermail/jmh-dev/2020-October/003039.html > > I've prototyped it and found few corners which I'd like to highlight and discuss. > > The initial purpose of the change is to be able to use underscores for the sake of better readability in both code and text reports: > > `@Param("1_000", "10_000", "100_000")` > > and > > > Benchmark (listSize) Mode Cnt Score Error Units > ShowOff.consume 1_000 thrpt 42294.795 ops/s > ShowOff.consume 10_000 thrpt 4057.322 ops/s > ShowOff.consume 100_000 thrpt 2866.069 ops/s > > > > While doing so, I've decided that it would be nice to support the strict subset of actual Java literals (at least to have a reference to point at) which has a lot of pitfalls: > > * Now we have (?) to support octal, binary and hexadecimal literals > * The actual grammar is quite wild, so literals like `0_12___3_4` are also supported > * `l` and `L` at the end of `long` literals are not supported (it seems a bit weird to do so) > * `NumericLiteralsParser` leaks to public API, so the generated benchmarks can invoke it (not sure what's the API policy here, but it's worth pointing it out) > * Underscores in floating points literals are not supported, mostly because then I have to match hexadecimal literals with underscores as well. No particular reason apart from "it's extra work without clear benefits". I can implement it if it's required for the PR though. > > Most importantly, support of such literals will break existing benchmarks that prefixed their numeric parameters with zero -- now they are interpreted as octal literals (and either rejected, e.g. `09` or converted to decimal, breaking the original authors intent). Previously, `X.parseX` functions (e.g. `Integer.parseInt`) were used and they are okay with leading zeroes. > > Breaking change seems to be the blocker here, and I'd like to hear your opinion of the acceptable approach aligned with JMH API > > Potential alternatives: > > * Do nothing, don't support underscores > * Support only decimal literals > * Support any subset of literals (e.g. decimal and hexadecimal only) > * Just trim all the underscores and parse it as before via `Integer.parseInt` and so on Hi, sorry for extremely late reply. This is a tough one compatibility-wise. I think it would be safer to: - Drop octal literals support, leave only binary, decimal, hexadecimal; they seem to be unambiguous when applied over integral types; - Move `NumericLiteralsParser` into generated benchmark code to avoid exposure to external code; yes, that would make unit testing much less convenient, you would have to do real JMH tests in `jmh-core-it` to reach the code; and put negative tests in `jmh-core-ct`, so we can check that known-bad values are rejected at compile time; - Need additional test to verify that `@Param` over `String` does not accidentally converts the values; - Figure out how hard would it be to support floating-point values, I'd think this one is useful in floating-point benchmarks `HexadecimalFloatingPointLiteral HexSignificand BinaryExponent` Don't invest much time into this, as we might run into some unknown blocker going forward, which would derail all this. ------------- PR: https://git.openjdk.java.net/jmh/pull/50 From shade at openjdk.java.net Tue Nov 30 10:41:24 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 30 Nov 2021 10:41:24 GMT Subject: RFR: CODETOOLS-7903008: JMH: Support incremental annotation processing for Gradle Java plugin In-Reply-To: References: <8eHsfvcEomVxu8CFXIUmgnLnZe21YCZ5vnnwfKu5L0k=.9b33608f-babd-44b8-8ddf-26f9e5a0a072@github.com> Message-ID: On Fri, 6 Aug 2021 07:23:22 GMT, Aleksey Shipilev wrote: >> Please hold off on merging. After running through some more complex benchmark examples, I've found a place where we are not using Filer to write classes. `StateObjectHandler.writeStateOverrides` seems problematic. Looking to see if I can fix that. > >> Please hold off on merging. After running through some more complex benchmark examples, I've found a place where we are not using Filer to write classes. `StateObjectHandler.writeStateOverrides` seems problematic. Looking to see if I can fix that. > > I don't see a problem there? `StateObjectHandler.writeStateOverrides` delegates to `GeneratorDestination.newClass`, which in calls `APGeneratorDestination.newClass` in annotation processing mode, which uses `Filer`. > Sorry to be a bother, but would you mind having another look at this one @shipilev? Hi! Sorry for delay. This looks marginally okay, although I was getting a bit nervous about implementing new stuff to support (unsupported) Gradle builds. But I think this is okay. Now that it affects core code, we have to figure out a bit of testing. Please merge from the `master`, and see if https://github.com/twicksell/jmh/actions have workflows enabled for this PR. Those should be green. ------------- PR: https://git.openjdk.java.net/jmh/pull/43 From shade at openjdk.java.net Tue Nov 30 16:06:54 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 30 Nov 2021 16:06:54 GMT Subject: RFR: CODETOOLS-7903068: JMH: Enable compiler blackholes by default, if available [v2] In-Reply-To: References: Message-ID: > With the release of JDK 17, we can finally consider enabling [compiler blackholes](https://shipilev.net/jvm/anatomy-quarks/27-compiler-blackholes/) by default. Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: Reconcile the meaning of "default" Blackhole mode ------------- Changes: - all: https://git.openjdk.java.net/jmh/pull/57/files - new: https://git.openjdk.java.net/jmh/pull/57/files/8ada9f99..47828f8a Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jmh&pr=57&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jmh&pr=57&range=00-01 Stats: 6 lines in 1 file changed: 1 ins; 3 del; 2 mod Patch: https://git.openjdk.java.net/jmh/pull/57.diff Fetch: git fetch https://git.openjdk.java.net/jmh pull/57/head:pull/57 PR: https://git.openjdk.java.net/jmh/pull/57 From duke at openjdk.java.net Tue Nov 30 16:48:24 2021 From: duke at openjdk.java.net (duke) Date: Tue, 30 Nov 2021 16:48:24 GMT Subject: git: openjdk/jmh: 7903068: JMH: Enable compiler blackholes by default, if available Message-ID: <86f8d73e-be88-44ae-bf9c-2776bc41c61a@openjdk.java.net> Changeset: fcf18d57 Author: Aleksey Shipil?v Committer: GitHub Date: 2021-11-30 17:47:30 +0000 URL: https://git.openjdk.java.net/jmh/commit/fcf18d57852cf00c88a8da5c947c6afc0505cba9 7903068: JMH: Enable compiler blackholes by default, if available ! jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java From shade at openjdk.java.net Tue Nov 30 16:50:22 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 30 Nov 2021 16:50:22 GMT Subject: Withdrawn: CODETOOLS-7903068: JMH: Enable compiler blackholes by default, if available In-Reply-To: References: Message-ID: On Tue, 30 Nov 2021 10:06:10 GMT, Aleksey Shipilev wrote: > With the release of JDK 17, we can finally consider enabling [compiler blackholes](https://shipilev.net/jvm/anatomy-quarks/27-compiler-blackholes/) by default. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.java.net/jmh/pull/57