Skip to content

Details

http://photos4.meetupstatic.com/photos/event/b/7/7/2/event_101566962.jpeg

Iulian Dragos (http://www.iulidragos.org/?page_id=4) works at Typesafe (http://typesafe.com/) and was formerly Martin Odersky's student at EPFL. He currently works on Scala IDE, but has also done work on Scala compiler and language extensions.

Abstract:

Scala uses type erasure to compile away parametric polymorphism (generics), which induces a non-negligible performance cost. Essentially, type parameters are erased and replaced by their upper bound, defaulting to `Object`. It follows that code involving primitive types will have to be adapted to work on objects, by adding appropriate boxing and unboxing operations. Programs that manipulate boxed primitive values may suffer a slow-down of ten times compared to hand-specialized code. This in turn leads to programmers avoiding generic collections, and writing hand-written specialized versions over and over.

Scala 2.8 adds specialized type parameters. A specialized type parameter instructs the compiler to generate a generic version and a number of specialized versions of the given definition, and use the most specific version whenever the static type information at a call site allows it.

Related topics

You may also like