-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing the modification introduced from #64 seems the speed of LINQ query is very poor #65
Comments
Adding some measurement objects we found this:
The highest time lost is measured from
Since the enumerator iterates over 1000 elements, the mean time is 13 milliseconds in this test. So the code wasting time is: public object[] GetData(IEntityType tName)
{
if (Data == null) return null;
var array = Data.Select((o) => o.Value.Value).ToArray();
return array;
} Updating the code with the following: public object[] GetData(IEntityType tName)
{
#if DEBUG
Stopwatch fullSw = new Stopwatch();
Stopwatch newSw = new Stopwatch();
Stopwatch iterationSw = new Stopwatch();
try
{
fullSw.Start();
#endif
if (Data == null) return null;
#if DEBUG
newSw.Start();
#endif
object[] array = new object[Data.Count];
#if DEBUG
newSw.Stop();
iterationSw.Start();
#endif
for (int i = 0; i < Data.Count; i++)
{
array[i] = Data[i].Value;
}
#if DEBUG
iterationSw.Stop();
#endif
return array;
#if DEBUG
}
finally
{
fullSw.Stop();
Trace.WriteLine($"Time to GetData with length {Data.Count}: {fullSw.Elapsed} - new array took: {newSw.Elapsed} - Iteration took: {iterationSw.Elapsed}");
}
#endif
} The previous code reports multiple occurrences like:
The time used from each invocation of
a new test reports:
Continuing the tests the output is:
More or less the |
* Code update based on #65 (comment) * Removed IKafkaSerdesFactory and other code clean-up
Testing the modification introduced from this PR seems the speed of LINQ query is very poor; the following code
takes more or less 16 seconds to be executed as reported from the following output:
Elapsed context.Posts.Single(b => b.BlogId == 2) 16299 ms. Result is PostId: 2 Title: title Content: 2 BlogId: 2
Originally posted by @mariomastrodicasa in #64 (comment)
The text was updated successfully, but these errors were encountered: