RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v46]
Jim Laskey
jlaskey at openjdk.org
Fri Mar 24 15:58:13 UTC 2023
On Thu, 23 Mar 2023 01:12:20 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Jim Laskey has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Tidy javadoc
>> - Rename StringTemplate classes
>
> src/java.base/share/classes/java/lang/runtime/StringTemplateImpl.java line 40:
>
>> 38: * <p>
>> 39: * Values are stored by subclassing {@link Carriers.CarrierObject}. This allows specializations
>> 40: * and sharing of value shapes without creating a new class for each shape.
>
> Just curious, what specific benefits does subclassing offer over having `CarrierObject` as a field? I don't see how a new class is ever created for each shape in that scenario, as shapes are only used to construct the 2 MHs in the factory.
About a 15-20% performance gain by not having two levels of indirection.
> src/java.base/share/classes/java/lang/runtime/StringTemplateImplFactory.java line 88:
>
>> 86: *
>> 87: * @param fragments string template fragments
>> 88: * @param type method type
>
> Suggestion:
>
> * @param type method type accepting values' types and returning a StringTemplate
Changing
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1147771982
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1147775001
More information about the core-libs-dev
mailing list