1. sanping peng
  2. .NET DataStore
  3. Sunday, 23 January 2022 20: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.

 

 

sanping peng Accepted Answer Pending Moderation
  1. Sunday, 23 January 2022 20:43 PM UTC
  2. .NET DataStore
  3. # 1

I think implement datawindow(.net datastore) in .net(c#) will greatly improve develope efficient,after my test,the performance seems not so good and it's maybe the bottle neck to make developer involve in. 

If Appeon do more about performance optimization,.net datastore will make more value to developer.

Thanks.

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 24 January 2022 02:09 AM UTC
Yes, the .NET DataStore makes C# development much more productive. The performance should be similar to EF Core if you do apples-to-apples comparison.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 24 January 2022 00:09 AM UTC
  2. .NET DataStore
  3. # 2

Hi Sanping, The .NET DataStore takes time to be initialized the first time.  To get accurate measurement, please change i = 100 or more and let us know what you discover.  Thanks.  

 

Comment
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Monday, 24 January 2022 12:39 PM UTC
  2. .NET DataStore
  3. # 3

Hi Sanpin,

The first time any .NET code executes it must first be JIT compiled. The more complex the code the higher the JIT cost, usually showing as CPU and time costs. Please don't use the cost of the first execution to evaluate any .NET runtime.  

If you continue to create different DataStores after the first execution, you will get more details:

Test 1 Call the constructor method of the DataStore corresponding to the following model one after another.
After the application starts, the first call of the DataStore constructor is a little slow. The first time of DataStore containing DwCompute is a little slow.
This is related to the .NET loading mechanism.
No. Model Name Column (Count) Compute (Count) Cost (ms) Remark
1 D_Dept1Column                 1 0 204.9562 This first call of the DataStore is a little slow
2 D_Dept4Columns                 4 0 14.0282  
3 D_Dept8Columns                 8 0 9.4364  
4 D_Dept10Columns                10 0 6.3126  
5 D_Dept10Columns_HasCompute     10 1 123.2492 The first call of the DataStore containing DwCompute is a little slow
6

D_Dept10Columns_Has3Compute

10 3 7.9898  
7 D_Dept10Columns_Has6Compute    10 6 16.9319  
Test 2 Call the constructor method of the DataStore corresponding to the following model one after another.
Call DataStore with Compute first. It takes more time for the first time. But it all takes lesser time for calling the remaining constructors. 
No. Model Name Column (Count) Compute (Count) Cost (ms) Remark
1 D_Dept10Columns_Has6Compute    10 6 327.6201 Call DataStore with Compute first. It takes more time for the first time.
2 D_Dept1Column                 1 0 4.9595  
3 D_Dept4Columns                 4 0 7.8497  
4 D_Dept8Columns                 8 0 14.725  
5 D_Dept10Columns                10 0 5.0629  
6 D_Dept10Columns_HasCompute     10 1 10.609  
7 D_Dept10Columns_Has3Compute    10 3 8.472  
8 D_Dept10Columns_Has6Compute    10 6 6.194  
9 D_Dept1Column                 1 0 7.3677  
10 D_Dept4Columns                 4 0 2.3554  
11 D_Dept8Columns                 8 0 2.2928  
12 D_Dept10Columns                10 0 7.5245  
13 D_Dept10Columns_HasCompute     10 1 3.1203  
14 D_Dept10Columns_Has3Compute    10 3 4.2983  
           
Test  3 Call the constructor method 1000 times of the DataStore corresponding to the following model one after another. Exclude the first call, the average cost is about 4~6.5ms.
As the columns in the models grow, the time increase is very little.
As the compute fields increase, the time increase is large.
Call DataStore with Compute first. It takes more time for the first time. But it all takes lesser time for calling the remaining constructors. 
No. Model Name Column (Count) Compute (Count) Cost (ms) Remark
1 D_Dept1Column                 1 0 3934.8663  
2 D_Dept4Columns                 4 0 3998.6854 As the columns in the models grow, the time increase is very little.
3 D_Dept8Columns                 8 0 4027.2256  
4 D_Dept10Columns                10 0 4088.2945  
5 D_Dept10Columns_Hascompute     10 1 4948.3414 As the compute fields increase, the time increase is large.
6 D_Dept10Columns_Has3Compute    10 3 5674.2833  
7 D_Dept10Columns_Has6Compute    10 6 6589.0148  

 

If you want to use .NET DataStore in a Web API Server, then it will cost more microseconds only for the first constructor, and will only cost a few microseconds for every DataStore during the following days. If compute expression doesn't meet your server performance requirement and you are only using DataStore for database operations purposes, you can also uncheck the DwCompute option when converting the C# model. 

Regards, Logan

 

Comment
  1. sanping peng
  2. Monday, 24 January 2022 16:20 PM UTC
Hi,Logan,

Thanks for your reply.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.