From: Greg Burri Date: Sat, 6 May 2017 09:30:10 +0000 (+0200) Subject: Micro optimization to improve analysis speed by ~20% X-Git-Tag: 1.0.11~4 X-Git-Url: http://git.euphorik.ch/?a=commitdiff_plain;h=829c86a5f0f165438da8f8da2e072889065a4df1;p=master-thesis.git Micro optimization to improve analysis speed by ~20% --- diff --git a/Parasitemia/Parasitemia.sln b/Parasitemia/Parasitemia.sln index 545e796..9db6b13 100644 --- a/Parasitemia/Parasitemia.sln +++ b/Parasitemia/Parasitemia.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ParasitemiaUI", "ParasitemiaUI\ParasitemiaUI.fsproj", "{70838E65-F211-44FC-B28F-0ED1CA6E850F}" EndProject @@ -12,6 +12,9 @@ EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ParasitemiaCore", "ParasitemiaCore\ParasitemiaCore.fsproj", "{0F8A85F4-9328-40C3-B8FF-44FB39CEB01F}" EndProject Global + GlobalSection(Performance) = preSolution + HasPerformanceSessions = true + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU DebugGUI|Any CPU = DebugGUI|Any CPU diff --git a/Parasitemia/ParasitemiaCore/AssemblyInfo.fs b/Parasitemia/ParasitemiaCore/AssemblyInfo.fs index 184fbed..2bba4bb 100644 --- a/Parasitemia/ParasitemiaCore/AssemblyInfo.fs +++ b/Parasitemia/ParasitemiaCore/AssemblyInfo.fs @@ -34,8 +34,8 @@ open System.Runtime.InteropServices // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] -[] -[] +[] +[] do () \ No newline at end of file diff --git a/Parasitemia/ParasitemiaCore/EEOver.fs b/Parasitemia/ParasitemiaCore/EEOver.fs index a7791c9..0824e98 100644 --- a/Parasitemia/ParasitemiaCore/EEOver.fs +++ b/Parasitemia/ParasitemiaCore/EEOver.fs @@ -404,7 +404,7 @@ let private cubicroots (p : float[]) (r : float[,]) = for k = 1 to 3 do r.[2, k] <- 0.0 -let private biquadroots (p : float[]) (r : float[,]) = +let inline private biquadroots (p : float[]) (r : float[,]) = if p.[0] <> 1.0 then for k = 1 to 4 do p.[k] <- p.[k] / p.[0] diff --git a/Parasitemia/ParasitemiaCore/ImgTools/Morpho.fs b/Parasitemia/ParasitemiaCore/ImgTools/Morpho.fs index 4cb1f0b..6c8d7a0 100644 --- a/Parasitemia/ParasitemiaCore/ImgTools/Morpho.fs +++ b/Parasitemia/ParasitemiaCore/ImgTools/Morpho.fs @@ -29,7 +29,7 @@ type ExtremumType = | Maxima = 1 | Minima = 2 -let findExtremum (img : Image) (extremumType : ExtremumType) : IEnumerable = +let inline findExtremum (img : Image) (extremumType : ExtremumType) : IEnumerable when 'TDepth : unmanaged = let w = img.Width let h = img.Height let se = [| -1, 0; 0, -1; 1, 0; 0, 1 |] @@ -66,7 +66,7 @@ let findExtremum (img : Image) (extremumType : ExtremumType) : IE let level = imgData.[ni, nj, 0] let notSuppressed = not suppress.[ni, nj] - if level = currentLevel && notSuppressed then + if notSuppressed && level = currentLevel then suppress.[ni, nj] <- true sameLevelToCheck.Push(Point(nj, ni)) elif (if extremumType = ExtremumType.Maxima then level > currentLevel else level < currentLevel) then @@ -86,10 +86,10 @@ let findExtremum (img : Image) (extremumType : ExtremumType) : IE result.Select(fun l -> Points(l)) -let findMaxima (img : Image) : IEnumerable = +let inline findMaxima (img : Image) : IEnumerable when 'TDepth : unmanaged = findExtremum img ExtremumType.Maxima -let findMinima (img : Image) : IEnumerable = +let inline findMinima (img : Image) : IEnumerable when 'TDepth : unmanaged = findExtremum img ExtremumType.Minima type PriorityQueue () = diff --git a/Parasitemia/ParasitemiaUI/AssemblyInfo.fs b/Parasitemia/ParasitemiaUI/AssemblyInfo.fs index 89fc224..40e4529 100644 --- a/Parasitemia/ParasitemiaUI/AssemblyInfo.fs +++ b/Parasitemia/ParasitemiaUI/AssemblyInfo.fs @@ -34,8 +34,8 @@ open System.Runtime.InteropServices // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [] -[] -[] +[] +[] do () \ No newline at end of file