On Sun, 05 Oct 2008, Enrico Maria Giordano wrote:

Hi Enrico,

> E:\HARBOUR>speedtst --thread=8 --scale
> 10/05/08 19:12:22 Windows XP 5.1.2600 Service Pack 3
> Harbour 1.1.0dev (Rev. 9550) (MT)+ Borland C++ 5.5.1 (32 bit)
> THREADS: 8
> N_LOOPS: 1000000
>                                                        1 th.  8 th.  factor
> ============================================================================
> [ T001: x := L_C ]____________________________________  1.67   0.88 ->  1.91
> [ T002: x := L_N ]____________________________________  1.25   0.63 ->  2.00
> [ T003: x := L_D ]____________________________________  1.22   0.64 ->  1.90
> [ T004: x := S_C ]____________________________________  2.09   1.39 ->  1.51
> [ T005: x := S_N ]____________________________________  1.61   0.83 ->  1.94
> [ T006: x := S_D ]____________________________________  1.61   0.84 ->  1.91
> [ T007: x := M_C ]____________________________________  2.28   1.23 ->  1.85
> [ T008: x := M_N ]____________________________________  1.83   0.92 ->  1.98
> [ T009: x := M_D ]____________________________________  1.83   0.92 ->  1.98
> [ T010: x := P_C ]____________________________________  1.86   0.97 ->  1.92
> [ T011: x := P_N ]____________________________________  1.81   0.92 ->  1.97
> [ T012: x := P_D ]____________________________________  1.81   0.95 ->  1.90
> [ T013: x := F_C ]____________________________________  3.75   4.84 ->  0.77
> [ T014: x := F_N ]____________________________________  3.13   1.58 ->  1.98
> [ T015: x := F_D ]____________________________________  2.17   1.13 ->  1.93
> [ T016: x := o:GenCode ]______________________________  4.09   2.11 ->  1.94
> [ T017: x := o[8] ]___________________________________  3.23   1.67 ->  1.93
> [ T018: round( i / 1000, 2 ) ]________________________  4.08   2.06 ->  1.98
> [ T019: str( i / 1000 ) ]_____________________________ 10.26   8.00 ->  1.28
> [ T020: val( s ) ]____________________________________  4.52   2.44 ->  1.85
> [ T021: val( a [ i % 16 + 1 ] ) ]_____________________  7.95   4.09 ->  1.94
> [ T022: dtos( d - i % 10000 ) ]_______________________  7.75   5.94 ->  1.31
> [ T023: eval( { || i % 16 } ) ]_______________________ 10.61  20.06 ->  0.53
> [ T024: eval( bc := { || i % 16 } ) ]_________________  5.24   2.67 ->  1.96
> [ T025: eval( { |x| x % 16 }, i ) ]___________________  8.01  34.88 ->  0.23
> [ T026: eval( bc := { |x| x % 16 }, i ) ]_____________  5.47   2.81 ->  1.94
> [ T027: eval( { |x| f1( x ) }, i ) ]__________________  9.66  45.31 ->  0.21
> [ T028: eval( bc := { |x| f1( x ) }, i ) ]____________  7.11   3.59 ->  1.98
> [ T029: x := &( "f1(" + str(i) + ")" ) ]______________ 43.76  52.08 ->  0.84
> [ T030: bc := &( "{|x|f1(x)}" ); eval( bc, i ) ]______ 54.34  73.08 ->  0.74
> [ T031: x := valtype( x ) +  valtype( i ) ]___________  8.55   5.25 ->  1.63
> [ T032: x := strzero( i % 100, 2 ) $ a[ i % 16 + 1 ] ] 14.16   8.73 ->  1.62
> [ T033: x := a[ i % 16 + 1 ] == s ]___________________  6.59   3.42 ->  1.93
> [ T034: x := a[ i % 16 + 1 ] = s ]____________________  7.09   3.58 ->  1.98
> [ T035: x := a[ i % 16 + 1 ] >= s ]___________________  7.13   3.69 ->  1.93
> [ T036: x := a[ i % 16 + 1 ] <= s ]___________________  7.02   3.61 ->  1.94
> [ T037: x := a[ i % 16 + 1 ] < s ]____________________  7.05   3.64 ->  1.94
> [ T038: x := a[ i % 16 + 1 ] > s ]____________________  7.00   3.58 ->  1.96
> [ T039: ascan( a, i % 16 ) ]__________________________  6.09   3.14 ->  1.94
> [ T040: ascan( a, { |x| x == i % 16 } ) ]_____________ 56.69  33.28 ->  1.70
> [ T041: if i%1000==0;a:={};end; aadd(a,{i,1,.T.,s,s2 ] 20.73  47.44 ->  0.44
> [ T042: x := a ]______________________________________  1.78   0.97 ->  1.84
> [ T043: x := {} ]_____________________________________  4.26  32.91 ->  0.13
> [ T044: f0() ]________________________________________  2.11   1.13 ->  1.88
> [ T045: f1( i ) ]_____________________________________  3.06   1.58 ->  1.94
> [ T046: f2( c[1...8] ) ]______________________________  3.22   1.74 ->  1.86
> [ T047: f2( c[1...40000] ) ]__________________________  3.20   1.63 ->  1.97
> [ T048: f2( @c[1...40000] ) ]_________________________  3.23   1.64 ->  1.97
> [ T049: f2( @c[1...40000] ), c2 := c ]________________  3.36   1.69 ->  1.99
> [ T050: f3( a, a2, s, i, s2, bc, i, n, x ) ]__________  9.63   5.03 ->  1.91
> [ T051: f2( a ) ]_____________________________________  3.30   1.69 ->  1.95
> [ T052: x := f4() ]___________________________________ 38.06  43.86 ->  0.87
> [ T053: x := f5() ]___________________________________  6.58   4.63 ->  1.42
> [ T054: f_prv( c ) ]__________________________________  9.31   6.44 ->  1.45
> ============================================================================
> [   TOTAL   ]_________________________________________455.22 503.73 ->  0.90
> ============================================================================
> [ total application time: ]..................................1311.17
> [ total real time: ]..........................................959.06

Thank you very much. As I can see you two CPU machine and in all tests
which does not allocate new memory you have the factor close to 2.0.
Very nice. Also:
   [ T004: x := S_C ]______________________________  2.09   1.39 ->  1.51
Is quite good so the overhead caused by operating on the same reference
counter is relatively small. At least much smaller then in my machine.
So probably the same will be with spinlocks.
If you can please also make test for:
   speedtst --thread=2 --scale --exclude=mem
It will be much shorter due the less number of threads and tests.

But the cost of memory allocations is very big. To improve scalability
here memory manager optimized for MT mode is necessary. It's not directly
related to Harbour though we can add some workarounds to reduce the overhead
in Harbour layer. But rather not now. In real applications it should not
cause such big problem because threads will make also other things not only
allocate and free memory in a loop :-)

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

Reply via email to