Scala Programming Language
  1. Scala Programming Language
  2. SI-5097

Make use of scala.runtime.AbstractPartialFunction in explicit inheritance cases

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc Library
    • Labels:

      Description

      Dependent on SI-5096, this diff switches from "new PartialFunction" or "extends PartialFunction" on concrete classes to make use of AbstractPartialFunction, trimming a modest amount of classfile space.

        Issue Links

          Activity

          Hide
          Commit Message Bot added a comment -

          (extempore in r25854) AbstractPartialFunction.

          Contributed by Todd Vierling with minor mods by extempore. This is an
          obvious extension of AbstractFunctionN which I had some issue making
          work at the time. Sounds kind of pitiful given that the compiler patch
          is about two lines, but let's all agree to believe it was a different
          world then.

          This example program is impacted as follows:

          class A {
          def f: PartialFunction[Any, Int] =

          { case x: String => 1 }

          def g: PartialFunction[Any, Int] = f orElse

          { case x: List[_] => 2 }

          def h: PartialFunction[Any, Int] = g orElse

          { case x: Set[_] => 3 }

          }

          Before: 34943 bytes of bytecode
          After: 4217 bytes of bytecode

          A mere 88% reduction in size. "'Tis but a trifle!" Closes SI-5096, SI-5097.

          Show
          Commit Message Bot added a comment - (extempore in r25854 ) AbstractPartialFunction. Contributed by Todd Vierling with minor mods by extempore. This is an obvious extension of AbstractFunctionN which I had some issue making work at the time. Sounds kind of pitiful given that the compiler patch is about two lines, but let's all agree to believe it was a different world then. This example program is impacted as follows: class A { def f: PartialFunction [Any, Int] = { case x: String => 1 } def g: PartialFunction [Any, Int] = f orElse { case x: List[_] => 2 } def h: PartialFunction [Any, Int] = g orElse { case x: Set[_] => 3 } } Before: 34943 bytes of bytecode After: 4217 bytes of bytecode A mere 88% reduction in size. "'Tis but a trifle!" Closes SI-5096 , SI-5097 .

            People

            • Assignee:
              Unassigned
              Reporter:
              Todd Vierling
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development