Hi Rémy,

If it helps openjmh uses an annotation processor so you can use it with ant
build, the setup is just not documented  AFAIK but there is no reason it
does not work technically.
Then code usage is more or less close to junit, run is a main which will
include resources/files generated from the annotation processor, really
nothing crazy IMHO on that part (hard one is to use Blackhole properly and
tune the jvm for the bench) but happy to help if needed.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le ven. 23 juin 2023 à 10:15, Rémy Maucherat <r...@apache.org> a écrit :

> On Fri, Jun 23, 2023 at 10:07 AM Mark Thomas <ma...@apache.org> wrote:
> >
> > On 23/06/2023 08:34, Rémy Maucherat wrote:
> > > On Thu, Jun 22, 2023 at 8:55 PM <ma...@apache.org> wrote:
> > >>
> > >> This is an automated email from the ASF dual-hosted git repository.
> > >>
> > >> markt pushed a commit to branch main
> > >> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> > >>
> > >>
> > >> The following commit(s) were added to refs/heads/main by this push:
> > >>       new 944951302e Add control of byte decoding errors to ByteChunk
> and StringCache
> > >> 944951302e is described below
> > >>
> > >> commit 944951302e2f478879411dbff353f5818ad44121
> > >> Author: Mark Thomas <ma...@apache.org>
> > >> AuthorDate: Wed Jun 14 12:25:21 2023 +0100
> > >>
> > >>      Add control of byte decoding errors to ByteChunk and StringCache
> >
> > <snip/>
> >
> > >> +    /**
> > >> +     * Converts the current content of the byte buffer to a String
> using the configured character set.
> > >> +     *
> > >> +     * @param malformedInputAction      Action to take if the input
> is malformed
> > >> +     * @param unmappableCharacterAction Action to take if a byte
> sequence can't be mapped to a character
> > >> +     *
> > >> +     * @return The result of converting the bytes to a String
> > >> +     *
> > >> +     * @throws CharacterCodingException If an error occurs during
> the conversion
> > >> +     */
> > >> +    public String toStringInternal(CodingErrorAction
> malformedInputAction, CodingErrorAction unmappableCharacterAction)
> > >> +            throws CharacterCodingException {
> > >>           if (charset == null) {
> > >>               charset = DEFAULT_CHARSET;
> > >>           }
> > >>           // new String(byte[], int, int, Charset) takes a defensive
> copy of the
> > >>           // entire byte array. This is expensive if only a small
> subset of the
> > >>           // bytes will be used. The code below is from Apache
> Harmony.
> > >> -        CharBuffer cb = charset.decode(ByteBuffer.wrap(buff, start,
> end - start));
> > >> +        CharBuffer cb =
> charset.newDecoder().onMalformedInput(malformedInputAction)
> > >> +
> .onUnmappableCharacter(unmappableCharacterAction).decode(ByteBuffer.wrap(buff,
> start, end - start));
> > >
> > > Looking at the code, this is not equivalent, like charset.decode uses
> > > thread locals and so on. I will make a change so that charset.decode
> > > is used if is REPLACE REPLACE, if you don't mind. I'm pretty sure
> > > benching would show no performance difference though.
> >
> > Seems reasonable to me.
>
> BTW, for actual microbenchmarks, the OpenJDK people recommend using
> https://github.com/openjdk/jmh rather than whatever hack. Does anyone
> have any experience with it ?
> Since it is Maven based, microbenchmarks would need to be added in a
> separate mavenized location rather than the testsuite.
>
> Rémy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

Reply via email to