This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: For a balanced scala article

5 replies
Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.


On Thu, Dec 1, 2011 at 6:58 PM, marc <millstone@gmail.com> wrote:


On Thursday, December 1, 2011 6:55:56 AM UTC-8, Rex Kerr wrote:

 
Requires decompiling the bytecode to learn how to write performance-sensitive code (not an issue once learned).

Indeed.  Writing high-performance Scala is very doable, but it takes rather a while to learn how to do it by design rather than by getting it working and then profiling (which is much more labor-intensive than doing it right the first time).  (That said, that you can write high-performance code at _all_ is almost unique among languages with Scala's expressiveness.)




Do you know of any references for  tricks and techniques to get the most of your scala code?  I am using scala in HPCand could use a new bag a tricks for performance-critical areas.  So far, I have made great bounds by macro-optimizations (algorithm improvement and parallelization), but am now getting into the situation where I have to go micro.

We have tons of experience on this topic, I just wished I had time to do more blogging :(
 

This could be a post itself and am happy to move this to its own question.
marc



--
Viktor Klang

Akka Tech LeadTypesafe - Enterprise-Grade Scala from the Experts

Twitter: @viktorklang
marc
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: For a balanced scala article


On Thursday, December 1, 2011 10:02:46 AM UTC-8, √iktor Klang wrote:


On Thu, Dec 1, 2011 at 6:58 PM, marc <mill...@gmail.com> wrote:


On Thursday, December 1, 2011 6:55:56 AM UTC-8, Rex Kerr wrote:

 
Requires decompiling the bytecode to learn how to write performance-sensitive code (not an issue once learned).

Indeed.  Writing high-performance Scala is very doable, but it takes rather a while to learn how to do it by design rather than by getting it working and then profiling (which is much more labor-intensive than doing it right the first time).  (That said, that you can write high-performance code at _all_ is almost unique among languages with Scala's expressiveness.)




Do you know of any references for  tricks and techniques to get the most of your scala code?  I am using scala in HPCand could use a new bag a tricks for performance-critical areas.  So far, I have made great bounds by macro-optimizations (algorithm improvement and parallelization), but am now getting into the situation where I have to go micro.

We have tons of experience on this topic, I just wished I had time to do more blogging :(


You just spend to much time shipping awesome unicorns is the problem ;-) 
 


--
Viktor Klang

Akka Tech LeadTypesafe - Enterprise-Grade Scala from the Experts

Twitter: @viktorklang
ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: For a balanced scala article


2011/12/1 √iktor Ҡlang <viktor.klang@gmail.com>


On Thu, Dec 1, 2011 at 6:58 PM, marc <millstone@gmail.com> wrote:


On Thursday, December 1, 2011 6:55:56 AM UTC-8, Rex Kerr wrote:

 
Requires decompiling the bytecode to learn how to write performance-sensitive code (not an issue once learned).

Indeed.  Writing high-performance Scala is very doable, but it takes rather a while to learn how to do it by design rather than by getting it working and then profiling (which is much more labor-intensive than doing it right the first time).  (That said, that you can write high-performance code at _all_ is almost unique among languages with Scala's expressiveness.)




Do you know of any references for  tricks and techniques to get the most of your scala code?  I am using scala in HPCand could use a new bag a tricks for performance-critical areas.  So far, I have made great bounds by macro-optimizations (algorithm improvement and parallelization), but am now getting into the situation where I have to go micro.

We have tons of experience on this topic, I just wished I had time to do more blogging :(

I also have way more experience than I ever hoped to have, and also am starved for time.  Hopefully a few of us overly busy yet performance-minded folk can get together and write up some tips.

Ideally, one would like to cover profiling, benchmarking, low-level design patterns, how to help the JVM, patterns for high-performance threading, when to switch from high- to low-level patterns, and selection of algorithms based on use case.

But that's a lot of work.  I don't even have time to do half of one of those, let alone all of them, and you really need to know all of them to routinely produce high-performance code.

  --Rex
ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: For a balanced scala article


On Thu, Dec 1, 2011 at 2:10 PM, Patrik Andersson <pandersson@gmail.com> wrote:
That still does not tell us where the element goes (first or last); just that the collection argument itself goes to the right or left of the element.

Indeed.  For that, you need the mnemonic, "Write it where you want it to go."

  x +: coll   // x is first
  coll :+ x   // x is last

--Rex

Sebastien Bocq
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: For a balanced scala article


2011/12/1 Rex Kerr <ichoran@gmail.com>
I also have way more experience than I ever hoped to have, and also am starved for time.  Hopefully a few of us overly busy yet performance-minded folk can get together and write up some tips.

Ideally, one would like to cover profiling, benchmarking, low-level design patterns, how to help the JVM, patterns for high-performance threading, when to switch from high- to low-level patterns, and selection of algorithms based on use case.

But that's a lot of work.  I don't even have time to do half of one of those, let alone all of them, and you really need to know all of them to routinely produce high-performance code.

  --Rex

This would be a very useful resource. I saw some detailed performance analysis passing by on scala-user mailing list but unfortunately these ultimately get lost in the traffic. For example, I remember one where Paul Phillips reported how he improved performance critical sections by avoiding RichString but I can't find it anymore.

Maybe we can:
- create a scala-performance mailing-list.
- add a "Designing for Performance" page to the Scala Wiki under learning resources. We could collect progressively tips, observations, benchmarks or even links to email discussions over there.

Would that help?

--
Sébastien
Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: For a balanced scala article
+1 for both points.
So... +2 overall I guess :)

On 2 December 2011 21:35, Sébastien Bocq <sebastien.bocq@gmail.com> wrote:


2011/12/1 Rex Kerr <ichoran@gmail.com>
I also have way more experience than I ever hoped to have, and also am starved for time.  Hopefully a few of us overly busy yet performance-minded folk can get together and write up some tips.

Ideally, one would like to cover profiling, benchmarking, low-level design patterns, how to help the JVM, patterns for high-performance threading, when to switch from high- to low-level patterns, and selection of algorithms based on use case.

But that's a lot of work.  I don't even have time to do half of one of those, let alone all of them, and you really need to know all of them to routinely produce high-performance code.

  --Rex

This would be a very useful resource. I saw some detailed performance analysis passing by on scala-user mailing list but unfortunately these ultimately get lost in the traffic. For example, I remember one where Paul Phillips reported how he improved performance critical sections by avoiding RichString but I can't find it anymore.

Maybe we can:
- create a scala-performance mailing-list.
- add a "Designing for Performance" page to the Scala Wiki under learning resources. We could collect progressively tips, observations, benchmarks or even links to email discussions over there.

Would that help?

--
Sébastien



Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland