[Mono-dev] New (faster) Implementaiton for managed CharCopy

Andreas Nahr ClassDevelopment at A-SoftTech.com
Fri Mar 17 18:59:08 EST 2006


By the way, the timer is somewhat inaccurate, so here are somewhat more 
detailed results.

Z:\String>mono test.exe
Test: Length: 0, Source: 0, Dest: 0
  memcopy      : 2703
  CharCopy     : 1875
  CC autoalign : 1953
  CC aligned   : 2094
Test: Length: 1, Source: 0, Dest: 0
  memcopy      : 2968
  CharCopy     : 1922
  CC autoalign : 2047
  CC aligned   : 2110
Test: Length: 100, Source: 0, Dest: 0
  memcopy      : 6484
  CharCopy     : 4641
  CC autoalign : 4656
  CC aligned   : 4656
Test: Length: 10000, Source: 0, Dest: 0
  memcopy      : 2719
  CharCopy     : 2609
  CC autoalign : 2625
  CC aligned   : 2610

Test: Length: 0, Source: 1, Dest: 0
  memcopy      : 3250
  CharCopy     : 1859
  CC autoalign : 2203
  CC aligned   : 2094
Test: Length: 1, Source: 1, Dest: 0
  memcopy      : 3422
  CharCopy     : 1922
  CC autoalign : 2140
  CC aligned   : 2188
Test: Length: 100, Source: 1, Dest: 0
  memcopy      : 11047
  CharCopy     : 5437
  CC autoalign : 5422
  CC aligned   : 7219
Test: Length: 10000, Source: 1, Dest: 0
  memcopy      : 6922
  CharCopy     : 3468
  CC autoalign : 3485
  CC aligned   : 5172

Test: Length: 0, Source: 1, Dest: 1
  memcopy      : 3109
  CharCopy     : 1875
  CC autoalign : 2187
  CC aligned   : 2094
Test: Length: 1, Source: 1, Dest: 1
  memcopy      : 3063
  CharCopy     : 1922
  CC autoalign : 2234
  CC aligned   : 2375
Test: Length: 100, Source: 1, Dest: 1
  memcopy      : 7250
  CharCopy     : 7984
  CC autoalign : 4797
  CC aligned   : 4969
Test: Length: 10000, Source: 1, Dest: 1
  memcopy      : 2734
  CharCopy     : 6328
  CC autoalign : 2610
  CC aligned   : 2625

Test: Length: 0, Source: 0, Dest: 1
  memcopy      : 3094
  CharCopy     : 1859
  CC autoalign : 2203
  CC aligned   : 2094
Test: Length: 1, Source: 0, Dest: 1
  memcopy      : 3234
  CharCopy     : 1922
  CC autoalign : 2141
  CC aligned   : 2187
Test: Length: 100, Source: 0, Dest: 1
  memcopy      : 9547
  CharCopy     : 6344
  CC autoalign : 6437
  CC aligned   : 8813
Test: Length: 10000, Source: 0, Dest: 1
  memcopy      : 5562
  CharCopy     : 4610
  CC autoalign : 4625
  CC aligned   : 6890



----- Original Message ----- 
From: "Andreas Nahr" <ClassDevelopment at A-SoftTech.com>
To: "Zac Bowling" <zac at zacbowling.com>
Cc: <mono-devel-list at lists.ximian.com>
Sent: Saturday, March 18, 2006 12:33 AM
Subject: [Mono-dev] New (faster) Implementaiton for managed CharCopy


>I guess there is not much sense in discussing if we rely on the current
> (somewhat slow) memcopy function, so I took my evening and my results from
> back then (I remember that my CharCopy was REALLY tested for speed ;) - so
> here are the results:
>
> Quick summary: with one exception (which I ABSOLUTELY don't understand 
> why)
> ALL new Implementations are always faster, sometimes more than twice as 
> fast
> as current. The best overall is CharCopy autoalign. However I'm not sure 
> if
> this would work on non-x86 Platforms, but CC aligned should always work if 
> I
> understand the alignment issues right.
>
> Z:\String>mono test.exe
> Test: Length: 0, Source: 0, Dest: 0
>  memcopy      : 266
>  CharCopy     : 187
>  CC autoalign : 188
>  CC aligned   : 219
> Test: Length: 1, Source: 0, Dest: 0
>  memcopy      : 485
>  CharCopy     : 187
>  CC autoalign : 219
>  CC aligned   : 203
> Test: Length: 100, Source: 0, Dest: 0
>  memcopy      : 656
>  CharCopy     : 454
>  CC autoalign : 468
>  CC aligned   : 469
> Test: Length: 10000, Source: 0, Dest: 0
>  memcopy      : 266
>  CharCopy     : 265
>  CC autoalign : 266
>  CC aligned   : 266
>
> Test: Length: 0, Source: 1, Dest: 0
>  memcopy      : 328
>  CharCopy     : 187
>  CC autoalign : 219
>  CC aligned   : 203
> Test: Length: 1, Source: 1, Dest: 0
>  memcopy      : 375
>  CharCopy     : 188
>  CC autoalign : 218
>  CC aligned   : 219
> Test: Length: 100, Source: 1, Dest: 0
>  memcopy      : 1141
>  CharCopy     : 547
>  CC autoalign : 546
>  CC aligned   : 719
> Test: Length: 10000, Source: 1, Dest: 0
>  memcopy      : 688
>  CharCopy     : 343
>  CC autoalign : 344
>  CC aligned   : 531
>
> Test: Length: 0, Source: 1, Dest: 1
>  memcopy      : 313
>  CharCopy     : 187
>  CC autoalign : 219
>  CC aligned   : 203
> Test: Length: 1, Source: 1, Dest: 1
>  memcopy      : 500
>  CharCopy     : 203
>  CC autoalign : 219
>  CC aligned   : 235
> Test: Length: 100, Source: 1, Dest: 1
>  memcopy      : 734
>  CharCopy     : 797
>  CC autoalign : 484
>  CC aligned   : 485
> Test: Length: 10000, Source: 1, Dest: 1
>  memcopy      : 281
>  CharCopy     : 625
>  CC autoalign : 265
>  CC aligned   : 266
>
> Test: Length: 0, Source: 0, Dest: 1
>  memcopy      : 313
>  CharCopy     : 187
>  CC autoalign : 219
>  CC aligned   : 219
> Test: Length: 1, Source: 0, Dest: 1
>  memcopy      : 359
>  CharCopy     : 203
>  CC autoalign : 219
>  CC aligned   : 219
> Test: Length: 100, Source: 0, Dest: 1
>  memcopy      : 984
>  CharCopy     : 625
>  CC autoalign : 641
>  CC aligned   : 890                  <----------------------------------
> Already weired
> Test: Length: 10000, Source: 0, Dest: 1
>  memcopy      : 547
>  CharCopy     : 469
>  CC autoalign : 469
>  CC aligned   : 687                  <----------------------------------
> Extremely strange
>
> However somebody who understands more about alignment than me (+ mono
> unmanaged internals) has to look over it.
> It should then be simple to replace the current implementation.
> The Microbenchmark containing the Implementation is attached.
>
> Andreas
>


--------------------------------------------------------------------------------


> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list