RFR: 8317432: Async UL: Do not recompute strlen()
Aleksey Shipilev
shade at openjdk.org
Wed Oct 4 14:06:41 UTC 2023
On Tue, 3 Oct 2023 14:25:38 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi,
>
> This change does three things:
>
> 1. At construction of message we used to compute `strlen` and then `strcpy`, we change this to do only one `strlen` and then a `memcpy` instead.
> 2. A `strlen` used to be required to calculate the size when finding the next message in the iterator. We instead store the previously computed message length and so the `strlen` is no longer necessary. The cost of this is 8 bytes extra per message (64 -> 72 bytes).
> 3. There's also some code which alters the alignment to explicitly handle the alignment of `Message` and ensure that `_pos` starts at a `Message`-aligned pointer.
Superficially okay, but we need @navyxliu to review this too.
src/hotspot/share/logging/logAsyncWriter.cpp line 52:
> 50:
> 51: bool AsyncLogWriter::Buffer::push_back(LogFileStreamOutput* output, const LogDecorations& decorations, const char* msg) {
> 52: size_t len = strlen(msg);
Is it `const`?
src/hotspot/share/logging/logAsyncWriter.hpp line 87:
> 85: LogFileStreamOutput* const _output;
> 86: const LogDecorations _decorations;
> 87: size_t _msglen; // Length of message excluding NUL-byte
Is it `const`?
-------------
PR Review: https://git.openjdk.org/jdk/pull/16029#pullrequestreview-1657611819
PR Review Comment: https://git.openjdk.org/jdk/pull/16029#discussion_r1345852944
PR Review Comment: https://git.openjdk.org/jdk/pull/16029#discussion_r1345846661
More information about the hotspot-runtime-dev
mailing list