From fc5164fde284727174762e540751703901be99bb Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 12 Mar 2017 23:41:40 +0300 Subject: [PATCH] Minor code cleanup + microoptimization + readme update --- README.md | 2 +- WhiteRabbit/PermutationsGenerator.cs | 2 +- WhiteRabbit/StringsProcessor.cs | 2 +- WhiteRabbit/VectorsConverter.cs | 2 +- WhiteRabbit/VectorsProcessor.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c635c4..eb68131 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Multi-threaded performance with RyuJIT (.NET 4.6, 64-bit system) on quad-core Sa * If phrases of 6 words are allowed as well, then "more difficult" hash is solved in 30 seconds, "easiest" in 3 minutes, and "hard" in 6 minutes. -* If phrases of 7 words are allowed as well, then "more difficult" hash is solved in 6 minutes. +* If phrases of 7 words are allowed as well, then "more difficult" hash is solved in 3 minutes. Note that all measurements were done on a Release build; Debug build is significantly slower. diff --git a/WhiteRabbit/PermutationsGenerator.cs b/WhiteRabbit/PermutationsGenerator.cs index 4033214..aec4610 100644 --- a/WhiteRabbit/PermutationsGenerator.cs +++ b/WhiteRabbit/PermutationsGenerator.cs @@ -8,7 +8,7 @@ /// /// Code taken from https://ericlippert.com/2013/04/22/producing-permutations-part-three/ /// - internal class PermutationsGenerator + internal sealed class PermutationsGenerator { public static IEnumerable HamiltonianPermutations(int n) { diff --git a/WhiteRabbit/StringsProcessor.cs b/WhiteRabbit/StringsProcessor.cs index 76a26a4..fe248b3 100644 --- a/WhiteRabbit/StringsProcessor.cs +++ b/WhiteRabbit/StringsProcessor.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Numerics; - internal class StringsProcessor + internal sealed class StringsProcessor { public StringsProcessor(byte[] sourceString, int maxWordsCount, IEnumerable words) { diff --git a/WhiteRabbit/VectorsConverter.cs b/WhiteRabbit/VectorsConverter.cs index 6421f5c..a420108 100644 --- a/WhiteRabbit/VectorsConverter.cs +++ b/WhiteRabbit/VectorsConverter.cs @@ -9,7 +9,7 @@ /// Converts strings to vectors containing chars count, based on a source string. /// E.g. for source string "abc", string "a" is converted to [1, 0, 0], while string "bcb" is converted to [0, 2, 1]. /// - internal class VectorsConverter + internal sealed class VectorsConverter { public VectorsConverter(byte[] sourceString) { diff --git a/WhiteRabbit/VectorsProcessor.cs b/WhiteRabbit/VectorsProcessor.cs index a90d511..16229f2 100644 --- a/WhiteRabbit/VectorsProcessor.cs +++ b/WhiteRabbit/VectorsProcessor.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Numerics; - internal class VectorsProcessor + internal sealed class VectorsProcessor { private const byte MaxComponentValue = 8; private const int LeastCommonMultiple = 840;