F#FSharpMap vs Dictionary performance [英] F# FSharpMap vs Dictionary performance
问题描述
我正在编写一个计数功能(用于每行查找增量集),用于
内存使用情况如何?
谢谢
p>
我想知道F#immutable Map对标准字典的执行情况。
请参阅 Visual F#2010技术计算页241-242优化:使用可变数据结构。显示一个字典
的运行速度比一个 Map
的速度比在int上计算频率非常相似的设置一般来说,纯粹的功能性数据结构,如 Map
不仅仅是极其重要的功能。
在串行的情况下缓慢,但它们破坏了整个并行程序的可扩展性。我最近给了演讲。
BTW,不要忘记有一个 Seq.countBy
功能!
I was wondering how does the F# immutable Map perform against the standard Dictionary.
I am writing a count function (for each line lookup increment set) to use on large files with millions of lines and thousands of elements.
What about the memory usage?
Thanks
I was wondering how does the F# immutable Map perform against the standard Dictionary.
See Visual F# 2010 for Technical Computing pages 241-242 "Optimization: Use mutable data structures". Shows a Dictionary
running 5-40× faster than a Map
in the very similar setting of counting the frequencies on ints as a function of the number of unique keys.
In general, purely functional data structures like Map
are not only extremely slow in the serial case but they destroy scalability of entire parallel programs. I gave a lecture on this recently.
BTW, don't forget there is a Seq.countBy
function!
这篇关于F#FSharpMap vs Dictionary performance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!