[Mono-list] Some benchmarks

Pedro Santos pre@oninetspeed.pt
Sat, 07 Aug 2004 21:36:40 +0100


Hello, hello!

I have an aplication with many, many objects in memory that I have to
save/load to have persistence. I implemented an abstract framework that
enables me to make several persistence implementations. At this point, I
have implemented persistence in XML (I write, I read to DOM and parse --
can't use XmlSerializer cause I have some Hastables... :( ), and
implemented with the help of the BinaryFormatter. 

Before saving, I transform all my OO model in some simple classes that
contain only the necessary info to save/load. That's why I can apply a
BinaryFormatter easily.

I first tryed it in Microsoft .NET and found out that saving is much
more slower than loading... I wonder why! On the other hand, the same
test ou Mono/Linux got me that saving was faster than loading...

Now, I would like to understand the results, so I ask these questions:

1) Is writing to a file very much slower than reading from a file in
Windows? Does the oposite happens in Linux?

2) Any information on can add on this results? Are they "expected"
results?

Thanks.

Running on Microsoft .NET, I got this:

--- XmlPersistenceTester --- 
Alliances: 2 Rulers: 1011 Planets: 1011 
Save time: 00:02:23.9421060 
Load time: 00:00:44.6889300 
Size: 4,81 MB in 13146 files 

--- BinaryPersistenceTester --- 
Alliances: 2 Rulers: 1011 Planets: 1011 
Save time: 00:02:34.7549520 
Load time: 00:00:47.3296395 
Size: 10,2 MB in 13146 files

Running on Linux, Mono JIT compiler version 0.95, I got this:

 --- XmlPersistenceTester ---
Alliances: 2 Rulers: 1011 Planets: 1011
Save time: 00:01:07.6105670
Load time: 00:02:47.9479530

--- BinaryPersistenceTester ---
Alliances: 2 Rulers: 1011 Planets: 1011
Save time: 00:01:20.1833240
Load time: 00:03:13.55315

-- 
Pedro Santos <www.psantos.net>
"Si minor plus est ergo nihil sunt omnia..."