Re: Fast string operations



Chad Myers <cmyers@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Looping: I thought looping over arrays in managed code was "slow"
> (relatively speaking) because of all the bounds checking and whatnot. This
> is why people use unsafe code now and then to use pointer arithmetic to loop
> over arrays without all the unnecessary bounds checking.

It's not particularly slow, but it's actually irrelevant to what
Nicholas was suggesting - no arrays are created when you either use the
indexer or foreach.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Performance tuning
    ... might want to try using unsafe code, as you can do direct memory management ... also try and turn off bounds checking for arrays in unsafe code if you are ... That is: unless the generics actually ... implemented heuristics on algorithms to speed things up; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Performance tuning
    ... might want to try using unsafe code, as you can do direct memory management ... also try and turn off bounds checking for arrays in unsafe code if you are ... About generics / inheritance. ... implemented heuristics on algorithms to speed things up; ...
    (microsoft.public.dotnet.languages.csharp)
  • MemCpy revisited (in Unsafe code)
    ... Buffer.BlockCopyand Array.Copyseem do be fine for Arrays, ... do about copying memory in unsafe code? ...
    (microsoft.public.dotnet.framework)