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

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


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 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Test.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060318/b680553e/attachment.pl 


More information about the Mono-devel-list mailing list