Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265747

Improve performance of java.lang.record generated toString() method

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      I've compared performance of methods generated by Lombok's `@Value` annotation with methods generated for java.lang.record. There is a huge difference in toString method as a record create it with help of String.format method. I think it should be created with help of simple concatenation. More over it seems that hashCode() for some reason is also slower that the Lombok's one. Here is the public repository with JMH benchmarks and with flamegraphs showing the difference in implementation.
      https://github.com/wyhasany/lombokVsRecord


      Attachments

        Issue Links

          Activity

            People

              vromero Vicente Arturo Romero Zaldivar
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: