Skip to content

Commit

Permalink
Memory consumption measurements changed.
Browse files Browse the repository at this point in the history
Memory consumption measurements in Demo now consistent with those in benchmark.
  • Loading branch information
wolfgarbe authored Dec 13, 2017
1 parent 77e84bb commit da8e09d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SymSpell.Demo/SymSpell.Demo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Program
public static void Main(string[] args)
{
Console.Write("Creating dictionary ...");
long memSize = GC.GetTotalMemory(true);
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();

Expand Down Expand Up @@ -44,10 +45,11 @@ public static void Main(string[] args)
//if (!symSpell.CreateDictionary(path)) Console.Error.WriteLine("File not found: " + Path.GetFullPath(path));

stopWatch.Stop();
long memDelta = GC.GetTotalMemory(true) - memSize;
Console.WriteLine("\rDictionary: " + symSpell.WordCount.ToString("N0") + " words, "
+ symSpell.EntryCount.ToString("N0") + " entries, edit distance=" + symSpell.MaxDictionaryEditDistance.ToString()
+ " in " + stopWatch.Elapsed.TotalMilliseconds.ToString("0.0") + "ms "
+ (Process.GetCurrentProcess().PrivateMemorySize64 / 1000000).ToString("N0") + " MB");
+ (memDelta / 1024 / 1024.0).ToString("N0") + " MB");

//warm up
var result = symSpell.Lookup("warmup", SymSpell.Verbosity.All, 1);
Expand Down

0 comments on commit da8e09d

Please sign in to comment.