CSLA performance numbers

CSLA performance numbers

Old forum URL: forums.lhotka.net/forums/t/2564.aspx


CaymanIslandsCarpediem posted on Tuesday, March 20, 2007

I've been using CSLA for a few years now and have been VERY happy with it.  Recently we have decided to merge with another company which is in love with Nhibernate (I like it as well for apps that need cross DB support, otherwise I prefer just CSLA).  Anyway, our soon to be joined companies are now planning a new app so I decided to look at performance in a number of different scenerios.  I created a simple table with 16 columns and inserted a few hundred thousand rows into it.  Below are my results.  For the test, I timed how long it took to return 50,000 rows and bind that data to a grid.  All of these tests are simple client/server scenerios (local data portal).  Just thought I'd share the results in case anyone was interested.  I looped through each method of access three times.  Also, my CSLA objects were generated with the CodeSmith templates on CodePlex.

One thing that really jumped out at me was the difference between the Read-Only CSLA test (Csla.ReadOnlyBase<>) and the Editable CSLA test (Csla.BusinessBase<>).  Noticing that difference I then created another test called Editable No Rules CSLA which is exactly like the Editable CSLA test except I commented out the rules in AddBusinessRules (I'll include all the rules below so you can see they aren't much just 4 pretty simple rules).  Anyway, the difference by just removing the rules was a bit suprising and will be the topic of another post I plan soon, but for now here are my results if anyone is interested. 

Duration listed below is in milliseconds.

Dataset      Duration:3171.9968
Dataset      Duration:3203.248
Dataset      Duration:3203.248
Typed Dataset      Duration:4062.656
Typed Dataset      Duration:3968.9024
Typed Dataset      Duration:3953.2768
Read-Only CSLA      Duration:656.2752
Read-Only CSLA      Duration:609.3984
Read-Only CSLA      Duration:625.024
Editable CSLA      Duration:1796.944
Editable CSLA      Duration:1765.6928
Editable CSLA      Duration:1796.944
Editable No Rules CSLA      Duration:703.152
Editable No Rules CSLA      Duration:640.6496
Editable No Rules CSLA      Duration:687.5264
nHibernate      Duration:22407.1104
nHibernate      Duration:21266.4416
nHibernate      Duration:19563.2512
CSLA & nHibernate      Duration:23875.9168
CSLA & nHibernate      Duration:22172.7264
CSLA & nHibernate      Duration:21578.9536

The Rules:

ValidationRules.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("Name", 200));
ValidationRules.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("Mic", 4));
ValidationRules.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("Opol", 4));
ValidationRules.AddRule(CommonRules.StringRequired, "CreateDateString");

RockfordLhotka replied on Tuesday, March 20, 2007

What version of CSLA .NET? I'd expect 2.1+ to be substantially better than 2.0 for example, because AddBusinessRules() is called per-instance in 2.0, and only once per appdomain per type in 2.1+.

CaymanIslandsCarpediem replied on Tuesday, March 20, 2007

This test was done with CSLA 2.1.1 (C# version).

RockfordLhotka replied on Tuesday, March 20, 2007

That’s interesting. So then I wonder where the overhead is occurring.

 

Do you interact with the properties of those objects, or just load them? And when you load them, is it by field, or by property? In other words, are you somehow causing the rules to be checked during the load process? Or perhaps calling ValidationRules.CheckRules() in the DP_Fetch() method?

 

Rocky

 

From: CaymanIslandsCarpediem [mailto:cslanet@lhotka.net]
Sent: Tuesday, March 20, 2007 8:45 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] CSLA performance numbers

 

This test was done with CSLA 2.1.1 (C# version).

CaymanIslandsCarpediem replied on Tuesday, March 20, 2007

I don't interact with them, its loaded by field, but I think I do call ValidationRules.CheckRules() after the fetch ;-)  The code is in the office so I'll verify tomorrow.  I'm sure thats it though.

CaymanIslandsCarpediem replied on Wednesday, March 21, 2007

Just to verify, I was in fact calling ValidationRules.CheckRules on each item during the fetch.  Once removing that call, editable CSLA and read-only CSLA numbers in the test were basically identical.  So now I'm considering how I want to handle CheckRules ;-) (http://forums.lhotka.net/forums/thread/13345.aspx)

DesNolan replied on Tuesday, March 20, 2007

Wonderful, wonderful information. I've always wanted to have such figures. It was also great to note that even with the Rules in place CSLA was faster then any of the other methods. (Besides, how often do you need to load 50,000 editable objects, hey.)

Thanks,

Des Nolan

Copyright (c) Marimer LLC