Interesting; I reproduce these results. Same for compiled; compiled for .NET 4, the program takes 5x as long as the one compiled for .NET 2. I'll have fsbugs look into it.

By on 11/16/2010 11:36 AM ()

I think I've found the reason of error. List.min - function.
I changed the code. Net 4 program take same time as Net 2.

let levenshteinDistance s1 s2 =
let sa,sb:char [] * char [] = Array.ofSeq s1, Array.ofSeq s2
let n = Array.length sa
let transform (narr:int []) c =
let zip3wrapper xs =
let m = (min n (Array.length xs))-1
Array.zip3 sa.[..m] narr.[..m] xs.[..m]
let compute z (c', x, y) =
min (y+1) (z+1)|> min (x + abs (compare c' c))
// List.min [y+1; z+1; x + abs (compare c' c)]
Array.scan compute (narr.[0]+1) (zip3wrapper narr.[1..])
let res = Array.fold transform [|0..n|] sb
res.[res.Length-1]

By on 11/17/2010 2:04 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper