- sanping peng
- .NET DataStore
- Sunday, 23 January 2022 08:24 PM UTC
{
Stopwatch st = new Stopwatch();
st.Start();
for (int i = 0; i < 1; i++)
{
ds = new DataStore<appfunc>();
}
st.Stop();
Console.WriteLine("new datastore:" + st.Elapsed.TotalMilliseconds);
}
{
Stopwatch st = new Stopwatch();
st.Start();
for (int i = 0; i < 1; i++)
{
DataStore<appfunc> ds111 = new DataStore<appfunc>();
}
st.Stop();
Console.WriteLine("new datastore2:" + st.Elapsed.TotalMilliseconds);
}
appfunc is a poco model class with 14 common columns and six compute columns
First create new instance cost about 804ms
Second create new instance cost about 363ms
If a page with ten or more datastore,only create new instance will cost about 3 or more seconds,the performance can not be used in real world.
Why the difference time cost exist in the first time and the second time?
Why the compute columns more,the create instance time more?
Why the compute expression longer,the create instance time more?
Is there any best practice sample code(cache DwMeta or cache expression compile result or Other ways)?
Thanks.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.