IRIS Native API for .NET performance issue
I am surprised with the performance (poor) of Native API for .NET
Following code (where ^testGlobal,node1 has 50 records) takes 5 seconds to run. Anyone else think there is room for the improvement?
string global = "^testGlobal";
object[] Subs = new object[1];
Subs[0] = "node1";
try
{
IRISIterator iter = iris.GetIRISIterator(global, Subs);
foreach (var item in iter)
{
Console.WriteLine((string)(iter.CurrentSubscript));
}
}
catch (Exception ex)
{
}
Calling @Bob Kuszewski.
I think we need a bit more info about your data structure and your environment.
I built the following little program on my mac with .NET 5 and it runs really fast (reported as 0 ms). The data structure in my example, as you can see, is incredibly simple, so that might be the source of performance differences. I'm also running on localhost, which could be different on your setup.
Thanks for the quick response.
Yes, data structure is different and I was running over the network. Let me remove those variables and run few more tests.
I will get back to you soon.
Bob,
You are getting 0ms because you did not start the StopWatch :)
Can you please add that to your code and test it at your end?
var watch = new System.Diagnostics.Stopwatch(); watch.Start();
It runs in only 10 milliseconds (less if I don't actually print to console) on my machine.
But the time is nowhere near the 5 seconds in your original post, which is why I think we need to know more about your application. If you take the same code as above what timing do you see?
Even your exact code is taking close to 3.5 seconds for me. I am running the code remotely compare to your localhost.
Which evidently proves that you have to chase a network performance problem ( !! REMOTELY !!)
and not a problem in the code of the API.