Performance

Sep 15, 2010 at 2:28 PM

Hello,

i have a project where i have an business object which has about 20000 instances. I know it's a lot, but it's a customer requirement. It takes about one and a half minute to save all these instances with "normal" sql. Wouldn't it be much more slower with your framework?

 

Kind regards svbirdy

Coordinator
Sep 15, 2010 at 2:34 PM

Well the first question would be why are you needing to "save" all 20000 objects at one time?  Is this a bulk insert to populate the database?

The ORM may actually be faster than your current method - it really depends on how your "normal" operation is inserting.  The ORM framework uses some reflection, yes, but typically only the first time it encounters a Type.  Form that point on, it's usually using cached information.  It also doesn't use the SQL query parser for much of anything - it uses TableDirect for most operations, which is an order of magnitude faster than using actual SQL statements, so if your "normal" operation uses SQL, ORM will probably outperform it.

Sep 15, 2010 at 3:03 PM

No, i get these objects from a webservice as an array, so i can insert them one by one.

So i think i'll give it a try, when i have the time for it.

Is there anything i could speed up storing anyway?

 

Thans so far

svbirdy

Coordinator
Sep 15, 2010 at 3:05 PM

I don't think there's much you can do to improve the insert performance that the library should achieve today (though if you're cascading, there may be room for improvement).  Performance was one of my main goals when I was writing the code, so there's probably not a lot of room left for improvement.  Not saying that the code is perfect, but all of the "easy" gains are already taken advantage of.

Sep 16, 2010 at 12:16 PM

Before i insert my business objects, i want to delete the "old" data.

I think when the table  has many data, wouldn't it be faster to drop the table and than recreate it?

 

As far as i can see, there is no posibillity to reuse a database, you've alway create a new one? Is there a reason for this?

 

Kind regards

svbirdy

Coordinator
Sep 16, 2010 at 2:12 PM

The sample always recreates the database becasue it makes my testing easier.  You certainly don't have to do that - just don't call File.Delete and CreateStore.  Give the ORM the path to the existing data file and you're done.