Two canonical examples for specialization:
- Function1
- Tuple2
Specializing Function1 is a lot easier because functions do not have specialized fields.
This is an example of using the miniboxing plugin in the Scala interpreter. For the benchmark, we reverse a 10M integer array, and compare the performance of the generic version and the miniboxed version.
You get 4-9x speedups by adding a single @miniboxed annotation:
scala> def reverse_gen[T](array: Array[T]): Unit = ...
As compiled by Kevin Wright a.k.a @thecoda
(executive producer of the movie, and I didn't even know it... clever huh?)
please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!
This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!
Monday June 16th
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb