Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/2364474.2364483acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Haskell vs. f# vs. scala: a high-level language features and parallelism support comparison

Published: 15 September 2012 Publication History

Abstract

This paper provides a performance and programmability comparison of high-level parallel programming support in Haskell, F# and Scala. Developing several parallel versions, we employ skeleton-based, semi-explicit and explicit approaches to parallelism. We focus on advanced language features for separating computational and coordination aspects of the code and tuning performance. We also assess the impact of functional purity and multi-paradigm design of the languages on program development and performance.
Basis for these comparisons are several Barnes-Hut implementations of the n-body problem in all three languages, on both Linux and Windows. Our performance measurements on state-of-the-art multi-cores achieve a speedup up to 5.62 (on 8 cores) with a highly-tuned Haskell version. For comparable implementations in Scala and F# we achieve speedups of 4.51 (on 8 cores) and 2.28 (on 4 cores), respectively. We observe that near best speedups are achieved using the highest level abstraction in these languages.

References

[1]
G. Agha. Actors: a Model of Concurrent Computation in Distributed Systems. MIT Press, 1986. ISBN 0262010925.
[2]
J. Armstrong, R. Virding, C. Wikström, and M. Williams. Concurrent Programming in Erlang. Prentice Hall, second edition, 1995. ISBN 978-0135083017.
[3]
J. Barnes and P. Hut. A Hierarchical O(N log N) Force-calculation Algorithm. Nature, 324: 446--449, Dec. 1986. 10.1038/324446a0.
[4]
C. Campbell, R. Johnson, A. Miller, and S. Toub. Parallel Programming with Microsoft.NET - Design Patterns for Decomposition and Coordination on Multicore Architectures. Microsoft Press, Aug. 2010. URL http://msdn.microsoft.com/en-us/library/ff963553.aspx. ISBN 0-7356-5162-0.
[5]
B. L. Chamberlain, D. Callahan, and H. P. Zima. Parallel Programmability and the Chapel Language. International Journal of High Performance Computing Applications, 21 (3): 291--312, Aug. 2007. 10.1177/1094342007078442.
[6]
P. Charles, C. Grothoff, V. Saraswat, C. Donawa, A. Kielstra, K. Ebcioglu, C. von Praun, and V. Sarkar. X10: an Object-oriented Approach to Non-uniform Cluster Computing. In OOPSLA'05 - International Conference on Object Oriented Programming Systems Languages and Applications, pages 519--538. ACM Press, 2005. ISBN 1-59593-031-0. 10.1145/1094811.1094852.
[7]
M. Cole. Algorithmic Skeletons: Structured Management of Parallel Computation. MIT Press, Cambridge, MA, 1989. ISBN 0262530864.
[8]
G. Cong, S. Kodali, S. Krishnamoorthy, D. Lea, V. Saraswat, and T. Wen. Solving Large, Irregular Graph Problems Using Adaptive Work-Stealing. In ICPP'08 - International Conference on Parallel Processing, pages 536--545, Portland, OR, Sept. 2008. 10.1109/ICPP.2008.88.
[9]
J. Dean and S. Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. Commun. ACM, 51 (1): 107--113, Jan. 2008. 10.1145/1327452.1327492.
[10]
M. Frigo, C. E. Leiserson, and K. H. Randall. The Implementation of the Cilk-5 Multithreaded Language. In PLDI'98 - Conference on Programming Language Design and Implementation, pages 212--223, Montreal, Quebec, Canada, June 1998. 10.1145/277650.277725.
[11]
P. Haller and M. Odersky. Scala Actors: Unifying Thread-based and Event-based Programming. Theor. Comput. Sci, 410: 202--220, 2009. 10.1016/j.tcs.2008.09.019.
[12]
D. Kranz, R. Halstead Jr., and E. Mohr. Mul-T: A High-Performance Parallel Lisp. In PLDI'89 - Programming Languages Design and Implementation, pages 81--90, Portland, Oregon, June 21-23, 1989. 10.1145/73141.74825.
[13]
D. Lea. A Java fork/join Framework. In Java'00 - ACM 2000 Conference on Java Grande, pages 36--43. ACM Press, 2000. 10.1145/337449.337465.
[14]
D. Leijen, W. Schulte, and S. Burckhardt. The Design of a Task Parallel Library. In OOPSLA'09 - International Conference on Object Oriented Programming Systems Languages and Applications, pages 227--242. ACM Press, 2009. 10.1145/1640089.1640106.
[15]
X. Leroy, D. Doligez, A. Frisch, J. Garrigue, D. Rémy, and J. Vouillon. The OCaml System. Inst. National de Recherche en Informatique et en Automatique (INRIA), July 2011. Documentation and User's Manual.
[16]
R. Loogen, Y. Ortega-Mallén, and R. Peòa Marí. Parallel Functional Programming in Eden. J. of Funct. Programming, 15 (3): 431--475, May 2005. 10.1017/S0956796805005526.
[17]
D. K. Lowenthal, V. W. Freeh, and G. R. Andrews. Using Fine-grain Threads and Run-time Decision Making in Parallel Computing. Journal of Parallel and Distributed Computing, 37 (1): 41--54, 1996. 10.1006/jpdc.1996.0106.
[18]
S. Marlow, S. Peyton Jones, and S. Singh. Runtime Support for Multicore Haskell. In ICFP'09 - International Conference on Functional Programming, pages 65--78, Edinburgh, UK, Aug. 2009. ACM Press. 10.1145/1596550.1596563.
[19]
S. Marlow, P. Maier, H.-W. Loidl, M. K. Aswad, and P. Trinder. Seq no More: Better Strategies for Parallel Haskell. In Haskell'10 - Haskell Symposium, Haskell '10, pages 91--102, New York, NY, USA, 2010. ACM. 10.1145/1863523.1863535.
[20]
D. C. J. Matthews and M. Wenzel. Efficient Parallel Programming in Poly/ML and Isabelle/ML. In DAMP10 - Declarative Aspects of Multicore Programming, pages 53--62, Madrid, Spain, Nov. 2010. 10.1145/1708046.1708058.
[21]
E. Mohr, D. Kranz, and R. Halstead, Jr. Lazy Task Creation: A Technique for Increasing the Granularity of Parallel Programs. IEEE Transactions on Parallel and Distributed Systems, 2 (3): 264--280, July 1991. 10.1109/71.86103.
[22]
M. Odersky, et al. An Overview of the Scala Programming Language. Technical Report LAMP-REPORT-2006-001, EPFL Lausanne, Switzerland, 2006. Second edition.
[23]
S. Pfalzner and P. Gibbon. Many-Body Tree Methods in Physics, chapter 2: Basic Principles of the Hierarchical Tree Method. Cambridge University Press, 1996. 10.1017/CBO9780511529368. ISBN: 9780511529368.
[24]
R. Plasmeijer and M. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley, 1993. ISBN 0-201-41663-8.
[25]
A. Prokopec, P. Bagwell, T. Rompf, and M. Odersky. A Generic Parallel Collection Framework. In EuroPar'11 - International Conference on Parallel Processing, pages 136--147. Springer Verlag, 2011.
[26]
J. Reinders. Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism. O'Reilly, 2007. ISBN 0596514808.
[27]
J. Reppy, C. Russo, and Y. Xiao. Parallel Concurrent ML. In ICFP'09 - International Conference on Functional Programming, pages 257--268, Edinburgh, UK, Aug. 2009. ACM Press. 10.1145/1596550.1596588.
[28]
A. Sewe, M. Mezini, A. Sarimbekov, and W. Binder. Da capo con scala: Design and Analysis of a Scala Benchmark Suite for the Java Virtual Machine. In OOPSLA'11 - International Conference on Object Oriented Programming Systems Languages and Applications, pages 657--676. ACM Press, 2011. 10.1145/2048066.2048118.
[29]
Shootout. The Computer Language Benchmarks Game, June 2012. URL http://shootout.alioth.debian.org.
[30]
Sun. The Fortress Language. Talks and Posters, June 2012. URL http://research.sun.com/projects/plrg.
[31]
D. Syme, A. Granicz, and A. Cisternino. Expert F#. Apress Academic, 2007. ISBN 1590598504.
[32]
P. Totoo and H.-W. Loidl. Parallel Haskell Implementations of the n-body Problem. Concurrency and Computation: Practice and Experience, 2012. Submitted.
[33]
P. Trinder, K. Hammond, H.-W. Loidl, and S. Peyton Jones. Algorithm + Strategy = Parallelism. J. Funct. Program., 8: 23--60, January 1998. 10.1017/S0956796897002967.
[34]
P. Trinder, H.-W. Loidl, and R. Pointon. Parallel and Distributed Haskells. J. of Funct. Programming, 12 (5): 469--510, July 2002. 10.1017/S0956796802004343.
[35]
P. Trinder, K. Hammond, and H.-W. Loidl. Encyclopedia of Parallel Computing, chapter Parallel Functional Languages. Springer Verlag, Sept. 2011. ISBN 978-0387097657.

Cited By

View all
  • (2015)FIrM: Functional Middleware with Support to Multi-tenancy2015 IEEE 29th International Conference on Advanced Information Networking and Applications10.1109/AINA.2015.249(650-657)Online publication date: Mar-2015
  • (2014)Adding parallel Haskell to the undergraduate programming language courseJournal of Computing Sciences in Colleges10.5555/2667369.266740330:1(181-189)Online publication date: 1-Oct-2014
  • (2014)Parallel Haskell implementations of the N-body problemConcurrency and Computation: Practice & Experience10.1002/cpe.308726:4(987-1019)Online publication date: 25-Mar-2014

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
FHPC '12: Proceedings of the 1st ACM SIGPLAN workshop on Functional high-performance computing
September 2012
110 pages
ISBN:9781450315777
DOI:10.1145/2364474
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 September 2012

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. barnes-hut
  2. f#
  3. haskell
  4. n-body
  5. parallelism
  6. scala

Qualifiers

  • Research-article

Conference

ICFP'12
Sponsor:

Acceptance Rates

Overall Acceptance Rate 18 of 25 submissions, 72%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)18
  • Downloads (Last 6 weeks)1
Reflects downloads up to 19 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2015)FIrM: Functional Middleware with Support to Multi-tenancy2015 IEEE 29th International Conference on Advanced Information Networking and Applications10.1109/AINA.2015.249(650-657)Online publication date: Mar-2015
  • (2014)Adding parallel Haskell to the undergraduate programming language courseJournal of Computing Sciences in Colleges10.5555/2667369.266740330:1(181-189)Online publication date: 1-Oct-2014
  • (2014)Parallel Haskell implementations of the N-body problemConcurrency and Computation: Practice & Experience10.1002/cpe.308726:4(987-1019)Online publication date: 25-Mar-2014

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media