This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
This is my test code: With SQLite without Lightspeed I can do 40000 Inserts in 450 ms. (No N:M Inserts, just into a single table with 6 columns) With SQLite with Lightspeed I can do a handfull in 450 ms. What do I wrong? (OK some N:M Inserts but still...) What do I wrong?
DateTime d = DateTime.Now; using (var transScope = new TransactionScope()) { using (SchoolModelUnitOfWork uow = DataAccess.Context.CreateUnitOfWork()) { var schoolclass = new SchoolclassCode() { SchoolclassCodeName = "12c" }; uow.Add(schoolclass); var pupi1 = new Pupil() { FirstName = "Bastien1", LastName = "test1" }; var pupi2 = new Pupil() { FirstName = "Bastien2", LastName = "test2" }; var pupi3 = new Pupil() { FirstName = "Bastien3", LastName = "test3" }; schoolclass.Pupils.Add(pupi1); schoolclass.Pupils.Add(pupi2); schoolclass.Pupils.Add(pupi3); var doc = new Document() { Name = "Excel sheet", Tags = "sheet,doc,data,charts" }; pupi1.Documents.Add(doc); uow.SaveChanges(); } transScope.Complete(); } TimeSpan t = DateTime.Now - d; Debug.WriteLine(t.TotalMilliseconds); |
|
|
At least part of it is that you're including the time to setting up a new unit of work, connection and transaction, allocate IDs to the entities, wire up associations, etc. That's going to cost. Time the SaveChanges(). That will give you a much more accurate comparison. Performance will also be affected by the identity method (e.g. stay away from IdentityColumn for large numbers of items, because it defeats batching... but it could turn out to be more efficient for very small numbers of items, because it avoids the upfront call to KeyTable). |
|
|
From the Context.Logger output:
SELECT KeyTable.NextId AS "KeyTable.NextId" FROM KeyTable --> Time: 3 ms UPDATE KeyTable SET NextId = 241 --> Time: 2 ms INSERT INTO Document ( Id, Data, Name, Tags ) VALUES ( 236, NULL, 'Excel sheet', 'sheet,doc,data,charts' ); INSERT INTO SchoolclassCode ( Id, SchoolclassCodeName ) VALUES ( 231, '12c' ); INSERT INTO Pupil ( Id, FirstName, LastName, SchoolclassCodeId ) VALUES ( 232, 'Bastien1', 'test1', 231 ); INSERT INTO Pupil ( Id, FirstName, LastName, SchoolclassCodeId ) VALUES ( 233, 'Bastien2', 'test2', 231 ); INSERT INTO Pupil ( Id, FirstName, LastName, SchoolclassCodeId ) VALUES ( 234, 'Bastien3', 'test3', 231 ); INSERT INTO PupilDocument ( Id, DocumentId, PupilId ) VALUES ( 235, 236, 232 ) --> Time: 1 ms 438 Interesting... seems 430 seconds are for the c# stuff only. Hm... |
|