Changes for C# Code #226
scotttib
started this conversation in
Improvement suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dave,
Great Video and Videos!
thanks, Scott...
Changes for better results in C#:
To: (closer match to C++ code, and sb faster)
return myDict.TryGetValue(this.sieveSize, out int test) && test == this.countPrimes();
To: (know this shouldn't matter, but it seems to help most of the time)
int hold = this.bitArray.Count;
for (int i = 0; i < hold; i++)
Consider changing:
project properties->Build->advance-> set output debug to None (helps little bit, not sure why)
&
C#'s DateTime class is slow (this change help a lot)
A better way is using System.Diagnostics.StopWatch (This class is available in c++ too)
Code would be:
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
Beta Was this translation helpful? Give feedback.
All reactions