It's just a simple test. I used three methods to insert 0.1 million records, but I didn't test the efficiency of spelling 0.1 million SQL inserts.
The application is the. 1.60 dual-core CPU running on the dell M instance, with 2 GB memory. The server is HP360, 8 CPU, 4 GB memory, and SQL2000 database.
For reference only.
I. Call the InsertOnSubmit method of ctx every time to put the object:
100000 objects are generated at 14:29:55 on May 18, and placed directly into ctx. It takes 4 seconds.
SubmitChanges started at 14:29:59
14:33:25.
The runtime memory usage is about 4 MB.
Ii. Form a list. Finally, call the InsertAllOnSubmit method of ctx to put all objects in the list:
100000 objects are generated at 18:45:06,. It takes 1 second to put the object into the list.
18:45:07 it took 2 seconds to add all objects in the list to ctx.
The execution of submitChange started at 18:45:09 on May 18,. it should be because of the database's delay of 7 seconds. I personally think it is not important.
18:48:42.
The runtime memory usage is about 4 MB.
3. Every time a record is generated, the insertOnSubmit of ctx is called, and submitChanges is executed immediately. The message is reported every 5000 times.
19:41:28
19:41:29 0
19:42:08 5000 this 5000 entries took 39 seconds
19:43:39 10000 this 5000 entries took 91 seconds and 52 more
19:46:02 15000 this 5000 entries took 143 seconds and 52 more
19:49:17 20000 this 5000 entries took 195 seconds and 52 more
19:53:25 25000 this 5000 entries took 53 more than 248 seconds
30000 19:58:29 5000 this 304 entries took over 56 seconds
35000 20:04:28 5000 this 359 entries took over 55 seconds
40000 20:11:22 5000 this 414 entries took over 55 seconds
45000 20:19:14 5000 this 472 entries took over 58 seconds
20:28:05 50000 this 5000 entries took 531 seconds and 59 more
20:37:50 55000 this 5000 entries took 585 seconds and 54 more
20:48:35 60000 this 5000 entries took 60 more than 645 seconds
65000 21:00:38 5000 this 723 entries took over 78 seconds
70000 21:13:01 5000 this 743 entries took 20 more seconds
21:26:01 75000 this 5000 entries took 780 seconds and 37 more
... I can't wait. I shut down the program.
The runtime memory usage is about 4 MB.
Getting slower and slower.