faster closures in Scala via stack-allocation

121 views
Skip to first unread message

Miguel Garcia

unread,
Nov 4, 2012, 3:58:02 PM11/4/12
to scala-i...@googlegroups.com

Some brainstorm-level notes on accelerating closures (including but not only via MethodHandles)

  http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2012Q4/2012-11-04-FasterClosures.pdf

Comments are welcome!


Miguel

Nils Kilden-Pedersen

unread,
Nov 4, 2012, 4:01:44 PM11/4/12
to scala-i...@googlegroups.com

Awesometastic!

 


Miguel


Peter Empen

unread,
Nov 6, 2012, 3:19:09 PM11/6/12
to scala-i...@googlegroups.com
Hi Miguel,

just out of curiosity, since you are going for performance, can you spot any use cases for sun.misc.unsafe or something similar in Scala-land?

Peter

Miguel Garcia

unread,
Nov 6, 2012, 3:43:08 PM11/6/12
to scala-i...@googlegroups.com

I guess there must be opportunities for sun.misc.Unsafe, but I'd try first with what works for as many runtime environments as possible. Afterwards, fine tuning can start.

Right now we're getting closures doing too much pointer-chasing all over the heap. Any improvement there will be noticed immediately. Not that we're the only ones: here are two examples from Javascript VMs

  Grokking V8 closures for fun (and profit?)
    http://mrale.ph/blog/2012/09/23/grokking-v8-closures-for-fun.html

  Notes from the JS pit: closure optimization
    http://blog.cdleary.com/2010/05/notes-from-the-js-pit-closure-optimization/


Miguel
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/
Reply all
Reply to author
Forward
0 new messages