On Fri, 03 Oct 2008, Francesco Saverio Giudice wrote:

Hi Francesco,

> Here my test:
> Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
> L2 Cache Size: 3072 Kb, Bus: 200 Mhz
> 4 GB RAM, Vista Ultimate 32bit
> Harbour Terminal: Windows native console
> Harbour 1.1.0dev (Rev. 9542)
> Windows Vista 6.0.6001 Service Pack 1
> DS avail=1736532KB  OS avail=2063740KB  EMM avail=0KB  MemStat:Off
> Startup loop to increase CPU clock...
> 10/03/08 22:59:09 Windows Vista 6.0.6001 Service Pack 1
> Harbour 1.1.0dev (Rev. 9542) (MT) Borland C++ 5.5.1 (32 bit)
> N_LOOPS =    1000000                                   ST    MT  MT+
> [ empty loop overhead ]..............................0.08..0.08..0.09
> =====================================================================
> [ x := L_C ].........................................0.09..0.12..8.94
> [ x := L_N ].........................................0.09..0.09..3.78
> [ x := L_D ].........................................0.09..0.11..6.47
> [ x := S_C ].........................................0.12..0.16..5.76
> [ x := S_N ].........................................0.08..0.12..7.63
> [ x := S_D ].........................................0.09..0.11..4.12
> [ x := M_C ].........................................0.09..0.17..8.81
> [ x := M_N ].........................................0.11..0.14..5.63
> [ x := M_D ].........................................0.09..0.14..8.81
> [ x := P_C ].........................................0.12..0.17..7.35
> [ x := P_N ].........................................0.09..0.11..8.63
> [ x := P_D ].........................................0.09..0.14..6.91
> [ x := F_C ].........................................0.17..0.30.24.29
> [ x := F_N ].........................................0.22..0.25..8.80
> [ x := F_D ].........................................0.12..0.16..8.78
> [ x := o:GenCode ]...................................0.20..0.31.11.75
> [ x := 0 ]...........................................0.05..0.09..5.57
> [ round( i / 1000, 2 ) ].............................0.28..0.33.13.99
> [ str( i / 1000 ) ]..................................0.76..0.90.30.37
> [ val( s ) ].........................................0.30..0.37.10.83
> [ val( a [ i % 16 + 1 ] ) ]..........................0.58..0.72.21.18
> [ dtos( d - i % 10000 ) ]............................0.48..0.69.34.23
> [ eval( { || i % 16 } ) ]............................0.44..0.84.41.98
> [ eval( bc := { || i % 16 } ) ]......................0.31..0.41.15.54
> [ eval( { |x| x % 16 }, i ) ]........................0.41..0.69.28.16
> [ eval( bc := { |x| x % 16 }, i ) ]..................0.34..0.44.16.32
> [ eval( { |x| f1( x ) }, i ) ].......................0.58..0.90.39.76
> [ eval( bc := { |x| f1( x ) }, i ) ].................0.55..0.66.13.49
> [ x := &( "f1(" + str(i) + ")" ) ]...................2.89..4.04.56.72
> [ bc := &( "{|x|f1(x)}" ); eval( bc, i ) ]...........3.79..5.41.55.47
> [ x := valtype( x ) +  valtype( i ) ]................0.50..0.76.29.86
> [ x := strzero( i % 100, 2 ) $ a[ i % 16 + 1 ] ].....1.03..1.29.37.18
> [ x := a[ i % 16 + 1 ] == s ]........................0.51..0.59.11.92
> [ x := a[ i % 16 + 1 ] = s ].........................0.55..0.62.13.14
> [ x := a[ i % 16 + 1 ] >= s ]........................0.55..0.61.19.38
> [ x := a[ i % 16 + 1 ] <= s ]........................0.51..0.61.18.56
> [ x := a[ i % 16 + 1 ] < s ].........................0.53..0.59.19.31
> [ x := a[ i % 16 + 1 ] > s ].........................0.55..0.61.18.31
> [ ascan( a, i % 16 ) ]...............................0.36..0.48.17.47
> [ ascan( a, { |x| x == i % 16 } ) ]..................3.99..4.99.46.89
> [ if i%1000==0;a:={};end; aadd(a,{i,1,.T.,s,s2,a2,b..1.79..2.07.47.64
> [ x := a ]...........................................0.12..0.14..9.19
> [ x := {} ]..........................................0.14..0.36.29.95
> [ f0() ].............................................0.09..0.19.10.16
> [ f1( i ) ]..........................................0.25..0.30.13.45
> [ f2( c[1...8] ) ]...................................0.20..0.30.13.15
> [ f2( c[1...40000] ) ]...............................0.22..0.28.12.73
> [ f2( @c[1...40000] ) ]..............................0.20..0.28.13.06
> [ f2( @c[1...40000] ), c2 := c ].....................0.27..0.31.14.73
> [ f3( a, a2, s, i, s2, bc, i, n, x ) ]...............0.72..0.90.20.00
> [ f2( a ) ]..........................................0.19..0.30.13.42
> [ x := f4() ]........................................0.80..1.01.32.17
> [ x := f5() ]........................................0.36..0.55.33.96
> =====================================================================
> [ total application time: ].........................32.25.41.42.59.98
> [ total real time: ]................................32.58.41.66.31.65

Thank you very much. The multi thread version is the fastest but here
also the most expensive seems to be tests which allocates memory and use
critical sections. If using spinlocks gives some noticeable improvement
in OS2 then we can also try then in MS-Win. I tested them in my Linux
box but default non recursive mutexes are already implemented as futexes
(spinlocks before OS locks executed when it fails) so there is no important
speed improvement when I use them.
MinGW users can make some tests even now. It's enough to change in
garbage.c[72]:

   #if defined( HB_OS_OS2 ) && \

to:

   #if ( defined( HB_OS_OS2 ) || defined( __MINGW32__ ) ) && \

and recompile Harbour. It will enable spinlock code I created for
OS2 users.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to