Fast

The framework is very fast when it comes to loading or saving objects from/to the database. Opf3 is using reflection in combination with some caching and intelligent algorithm when filling the objects with the data. This makes it very fast. Even hard-coding the way of populating a persistent (see IPopulateHelper interface) is not a lot faster.

Speed can be improved a lot also by allowing Opf3 to inject code (static methods) in the persistent objects. That code is only used to fill properties or request the data of a property and does not affect or manipulate any of the peristent's code! For more information see the IDynamicPopulateHelper interface.

The test

The follwing example shows how fast Opf3 can be. The following graph represents the schema we used for our little test:

NAME TYPE
ID long; autoincrement
NAME varchar(50)
GENDER int
BIRTHDATE datetime
TEXT text
HEIGHT double

The test consisted in loading 100, 1000, 10000 and 100000 records from a table and measuring the time it took. We used the build in reflection algorithm to populate the persistent objects. The database in use was SQL Server 2005 and the PC running the test a Pentium M with 2.13 GHz and 2 GB RAM.


Results

The results are the following:

AMOUNT PER OBJECT TOTAL
100 0.09 ms 9 ms (~ 0.009 sec)
1000 0.08 ms 80 ms (~ 0.08 sec)
10000 0.08 ms 800 ms (~ 0.8 sec)
100000 0.07 ms 7000 ms (~ 7 sec)

You can see that Opf3 is really fast when loading objects.

Saving objects

Opf3 is also very fast when saving objects. Only objects changed in memory are saved back to the database. If you don't touch an object the framework skips that object during save. This behaviour is created because Opf3 generates two checksums: one after having loaded the object and one before trying to save. Generating checksums in memory is a lot faster then saving every item.

The framework uses also other algorithms to get and store the data as fast as possible. Try the framework to see how fast it is.