On Thu, 27 Jun 2024 14:12:36 GMT, Shaojin Wen <d...@openjdk.org> wrote:

>> Currently, the java.util.Formatter$Conversion::isValid method is implemented 
>> based on switch, which cannot be inlined because codeSize > 325. This 
>> problem can be avoided by implementing it with ImmutableBitSetPredicate.
>> 
>> use `-XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining` to see the master 
>> branch:
>> 
>> @ 109   java.util.Formatter$Conversion::isValid (358 bytes)   failed to 
>> inline: hot method too big
>> 
>> 
>> current version
>> 
>> @ 109   java.util.Formatter$Conversion::isValid (10 bytes)   inline (hot)
>>   @ 4   
>> jdk.internal.util.ImmutableBitSetPredicate$SmallImmutableBitSetPredicate::test
>>  (50 bytes)   inline (hot)
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   revert & use `@ForceInline`

I found using @ForceInline gave me better performance with smaller code changes,

Here are the performance numbers running on Mac M1 Max:

# baseline
Benchmark                     Mode  Cnt   Score   Error  Units
StringFormat.stringIntFormat  avgt   15  93.299 ? 1.268  ns/op

# WebRevs 00 fb5c8001
Benchmark                     Mode  Cnt   Score   Error  Units
StringFormat.stringIntFormat  avgt   15  89.164 ? 2.188  ns/op

# ForceInline
Benchmark                     Mode  Cnt   Score   Error  Units
StringFormat.stringIntFormat  avgt   15  84.473 ? 4.287  ns/op

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19926#issuecomment-2194818165

Reply via email to