- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: For a balanced scala article
Thu, 2011-12-01, 19:02
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
Thu, 2011-12-01, 20:07
#2
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
Thu, 2011-12-01, 20:17
#3
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
Fri, 2011-12-02, 22:37
#4
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
Fri, 2011-12-02, 22:57
#5
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:
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
On Thursday, December 1, 2011 10:02:46 AM UTC-8, √iktor Klang wrote:
You just spend to much time shipping awesome unicorns is the problem ;-)