Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add scala.runtime.AbstractPartialFunction #5096
The attached diff implements a PartialFunction analogue to scala.runtime.AbstractFunctionN. It takes the smallest possible footprint approach to the change, to avoid any possibility of a bare match block being interpreted as a plain Function (rather than properly a PartialFunction).
This trims about 9k of uncompressed class file size from every bare match block used as a PF. It may well speed up the use of PFs, as well, since all the trait stubs are reified in the AbstractPF class and not in every PF.
For scala-library.jar, this reduces total size a very minor amount (60k):
$ ls -l dists/scala-2.10.0.r25850-b20111018225736/lib/scala-library.jar
$ ls -l build/pack/lib/scala-library.jar
The gain is much more likely to be noticeable with Lift or other frameworks that work heavily with bare match blocks as PFs. I plan on submitting diffs under separate cover to make explicit use of scala.runtime.AbstractPartialFunction, to trim related cases where code is explicitly inheriting from the PF trait today.
Imported From: https://issues.scala-lang.org/browse/SI-5096?orig=1
Commit Message Bot (anonymous) said:
Contributed by Todd Vierling with minor mods by extempore. This is an
This example program is impacted as follows:
Before: 34943 bytes of bytecode