Why is F#'s Seq.sortBy much slower than LINQ's IEnumerable.OrderBy extension method?

前端 未结 2 751
清酒与你
清酒与你 2021-02-10 12:34

I\'ve recently written a piece of code to read some data from a file, store it in a tuple and sort all the collected data by the first element of the tuple. After some tests I\'

2条回答
  •  心在旅途
    2021-02-10 13:08

    A difference of x2 is not much when sorts are O(n.log(n)).

    Small differences in data structures (e.g. optimising for input being ICollection) could make this scale of difference.

    And F# is currently Beta (not so much focus on optimisation vs. getting the language and libraries right), plus the generality of F# functions (supporting partial application etc.) could lead to a slight slow down in calling speed: more than enough to account for the different.

提交回复
热议问题