[fpc-devel] performance tests: reference counted vs non-reference counted

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Nov 16 12:52:09 CET 2007


On Fri, 16 Nov 2007 14:34:03 +0300
Sergei Gorelkin <sergei_gorelkin at mail.ru> wrote:

> Graeme Geldenhuys wrote:
> 
> > No idea??  They seem to fluctuate after each run, but the overall
> > result (which tests are faster) are always constant.  Have a look at
> > the code, if there is a better way of testing this. The code is
> > pretty simple.  Just loop and create 10,000 objects in each loop.
> > 
> Your tests do not free the refcounted objects, but free the 
> non-refcounted ones. This probably explains why 'standard
> refcounting' test is faster than 'standard non-refcounting'.
> Still cannot say anything about custom BaseObject. Maybe you could 
> figure out the showstopper by using callgrind.

I tested your tests and the results were completely random.
- They need so much memory that the OS page handling interferes.
- You used the slow 'Now' function.

Decrease the CTestRunTime to 1 and let the loops run 1000000 and you
will get more reliable results:

$ ./performancetest 
13 iterations in 1 seconds (no reference counting)
11 iterations in 1 seconds (reference counting)
9 iterations in 1 seconds (no reference counting with MyBaseObject)
8 iterations in 1 seconds (reference counting with MyBaseObject)
$ ./performancetest 
13 iterations in 1 seconds (no reference counting)
11 iterations in 1 seconds (reference counting)
9 iterations in 1 seconds (no reference counting with MyBaseObject)
7 iterations in 1 seconds (reference counting with MyBaseObject)


Mattias



More information about the fpc-devel mailing list