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");
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+.
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).
Copyright (c) Marimer LLC