Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-675

Generated findByValue() should just switch on value instead of mapping

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.2
    • 0.3
    • Java - Compiler
    • None

    Description

      Generated enum classes currently use a map in findByValue() to go from an integer value to an enum.

      Instead of using a map, it is faster to simply switch on the value with a default case returning null.

      On some benchmarks I ran, this saved 7% of deserialization time.

      Attachments

        1. thrift-675.patch
          2 kB
          Bryan Duxbury

        Activity

          People

            bryanduxbury Bryan Duxbury
            cwalters Chad Walters
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: