On Tue, 25 Apr 2023 07:38:41 GMT, Adam Sotona <asot...@openjdk.org> wrote:
> Note that other `*Impl` classes in `java.lang.constant` perform validation in > their constructors and provide custom `toString()` formatting and they also > don’t use records. BTW: for example `ClassDesc:of(String name)` performs repeated validations and I see it as a performance bug. `ClassDesc::of` calls `ConstantUtils::validateBinaryClassName`, then it performs conversion `binaryToInternal` and calls `ClassDesc::ofDescriptor`, which checks for `ConstantUtils::arrayDepth` and calls `ReferenceClassDescImpl::new`, which again performns validation by calling `ConstantUtils::skipOverFieldSignature` and checking the result. There is plenty of space for performance improvements here, as all the validation and conversion can be done in one pass only. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13615#issuecomment-1521326927