Haskell,Scala,Clojure,为高性能模式匹配和并发选择什么 [英] Haskell, Scala, Clojure, what to choose for high performance pattern matching and concurrency

查看:314
本文介绍了Haskell,Scala,Clojure,为高性能模式匹配和并发选择什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始在FP上工作,最近阅读了大量的博客和帖子有关并发执行和性能的FP的优势。我对于FP的需求在很大程度上受到我正在开发的应用程序的影响,我的应用程序是一个基于状态的数据注入到另一个子系统,其中时间是非常关键的(接近每秒200万事务)。我有几个这样的子系统需要测试。
我正在认真考虑使用FP的并行性,并希望采取正确的方法,SO的许多帖子谈论了Scala,Haskell和Clojure wrt语言结构,库和JVM支持的缺点和优势。从语言的角度来看,只要能够帮助我实现结果,我就可以学习任何语言。

I have started work on FP recently after reading a lot of blogs and posts about advantages of FP for concurrent execution and performance. My need for FP has been largely influenced by the application that I am developing, My application is a state based data injector into another subsystem where timing is very crucial (close to a 2 million transactions per sec). I have a couple of such subsystems which needs to be tested. I am seriously considering using FP for its parallelism and want to take the correct approach, many posts on SO talk about disadvantages and advantages of Scala, Haskell and Clojure wrt language constructs, libraries and JVM support. From a language point of view I am ok to learn any language as long as it will help me achieve the result.

某些帖子喜欢Haskell的模式匹配和语言的简单性,基于JVM的FP lang在使用现有的java库方面有很大的优势。 JaneStreet是OCAML的大支持者,但我真的不知道OCAML的开发者支持和帮助论坛。

Certain posts favor Haskell for pattern matching and simplicity of language, JVM based FP lang have a big advantage with respect to using existing java libraries. JaneStreet is a big OCAML supporter but I am really not sure about developer support and help forums for OCAML.

如果有人处理这样的大数据,请分享您的经验。

If anybody has worked with handling such large data, please share your experience.

推荐答案

您要快速还是想要轻松吗?

如果你想快速,你应该使用C ++,即使你使用FP原则来帮助正确性。由于时序至关重要,对软(和硬,如果需要的话)实时编程的支持将是重要的。您可以准确地决定如何以及何时有恢复记忆的时间,并且只花费与您一样的时间。

If you want fast, you should use C++, even if you're using FP principles to aid in correctness. Since timing is crucial, the support for soft (and hard, if need be) real-time programming will be important. You can decide exactly how and when you have time to recover memory, and spend only as much time as you have on that task.

您所说的三种语言是比近似最佳手动调整慢2-3倍的C ++趋向于,然后只有在用相当传统的命令式方式使用时。他们都使用垃圾收集,这将在您的交易中引入不受控制的随机延迟。

The three languages you've stated all are ~2-3x slower than near-optimally hand-tuned C++ tends to be, and then only when used in a rather traditional imperative way. They all use garbage collection, which will introduce uncontrolled random delays in your transactions.

现在,这是一个很大的工作这个运行在与C ++的防弹方式。应用FP原则需要更多的样板(甚至在C ++ 11中),并且大多数库默认是可变的。

Now, that said, it's a lot of work to get this running in bulletproof fashion with C++. Applying FP principles requires considerably more boilerplate (even in C++11), and most libraries are mutable by default.

也许你没有时间,缩小其他规格。如果不是定时吞吐量是至关重要的,例如,你可能想要Scala over Clojure(参见计算机语言基准游戏,其中Scala赢得本文写作的每个基准在每种情况下都具有较低的代码大小); OCaml和Haskell应该被选择用于其他原因(类似的基准分数,但他们有不同的语法和互操作性等)。

Maybe you don't have the time and can afford to scale back on other specifications. If it is not timing but throughput that is crucial, for example, then you probably want Scala over Clojure (see the Computer Languages Benchmark Game, where Scala wins every benchmark as of this writing and has lower code size in almost every case); OCaml and Haskell should be chosen for other reasons (similar benchmark scores, but they have different syntax and interoperability and so on).

至于哪个系统有最好的并发支持,Haskell,Clojure和Scala都很好,而OCaml有点缺乏。

As far as which system has the best concurrency support, Haskell, Clojure and Scala are all just fine while OCaml is a bit lacking.

这大大缩小到Haskell和Scala。你需要使用Java库吗? Scala。你需要使用C库吗?可能是Haskell。你不需要吗?然后你可以选择一个你喜欢的风格,而不必担心过多,你已经使你的生活更艰难选择错误的人。

This pretty much narrows it down to Haskell and Scala. Do you need to use Java libraries? Scala. Do you need to use C libraries? Probably Haskell. Do you need neither? Then you can choose either on the basis of which one you prefer stylistically without having to worry overly much that you've made your life vastly harder by choosing the wrong one.

这篇关于Haskell,Scala,Clojure,为高性能模式匹配和并发选择什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆