RFR: 8352536: Add overloads to parse and build class files from/to MemorySegment [v5]
David M. Lloyd
duke at openjdk.org
Fri Apr 4 13:09:12 UTC 2025
On Fri, 28 Mar 2025 15:53:15 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> David M. Lloyd has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add a benchmark for class file emission
>
> https://github.com/openjdk/jdk/pull/24297/files
I've had a look at the comparison benchmark and I did a couple other tests to see whether some percentage of pass-through versus recreation would show anything interesting. My conclusion is that @asotona is right in that when processing each element of, or just creating from scratch, any decently-sized class, the copy overhead vanishes in proportion to the overhead of class creation itself. The relative allocation overhead remains significant in this case, which may result in additional GC cycles. @liach is also correct in that we could theoretically reduce this allocation by avoiding the resize/copy cycle of byte arrays.
I remain convinced that none of this invalidates the usefulness of this change, or invalidates the argument that the cost of this change is low, but we're all busy people and so I'm not going to continue pushing this against a strong headwind. Maybe we can revisit it at some later time if there is enough interest from third parties. For now I will just live with the extra copies.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24139#issuecomment-2778685789
More information about the core-libs-dev
mailing list