Revision 29667

Date:
2008/07/22 05:35:25
Author:
japhb
Revision Log:
Merge branch 'benchmarks'
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/examples/benchmarks/float4.pir

     
    9 9
    10 10 =head1 DESCRIPTION
    11 11
    12 This benchmark compares 4 different ways of defining and filling a float4
    12 This benchmark compares 5 different ways of defining and filling a float4
    13 13 structure (a common vector length, especially for graphics).
    14 14
    15 15 =cut
     
    74 74 .local pmc float4
    75 75 .local int i
    76 76
    77 # Time named struct elements treated as array
    78 float4 = new 'ManagedStruct', named_struct
    79 i = count
    80 start = time
    81
    82 named_struct_array_loop:
    83 float4[0] = start
    84 float4[1] = start
    85 float4[2] = start
    86 float4[3] = start
    87 dec i
    88 if i goto named_struct_array_loop
    89
    90 stop = time
    91 elapsed = stop - start
    92 print 'Array Struct: '
    93 say elapsed
    94
    77 95 # Time struct element per array element
    78 96 float4 = new 'ManagedStruct', struct
    79 97 i = count