Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scabug opened this issue Oct 19, 2011 · 2 comments
Closed

Comments

@scabug
Copy link

@scabug scabug commented Oct 19, 2011

Dependent on #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.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 19, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5097?orig=1
Reporter: Todd Vierling (tvierling)
Attachments:

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 19, 2011

Commit Message Bot (anonymous) said:
(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 #5096, #5097.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.