From: Patrick Flanagan on
I noticed high cpu usage with this function when it was used in a handler for
a SerialPort. Using the string.replace method fixes the issue, but using a
StringBuilder would be preferable to avoid generating garbage.

Has anyone else had performance issues with this function on the compact
framework? I've seen a few article that do comparisons between the
StringBuilder, string, and regex replace methods, but none have observed this
large performance gap I am seeing (cf vs. non-cf maybe?).
From: Alberto Silva, MVP on
As in many scenarios, with .NET CF, and btw SQL Compact also, when
performance is a concern, you should test yourself, like doing 1000
iteractions with different methods, taking your conclusions about time
performance with the application compiled in Release mode, and then also
with the .NET CF Remote Perfomance Monitor and also the .NET CF CLR Profiler
to check between the different approaches which one require less GC.Collect,
that instantiates least objects, ... and then making your choice according
the results.

Alberto Silva

"Patrick Flanagan" <PatrickFlanagan(a)discussions.microsoft.com> escreveu na
mensagem news:08B81DCA-4008-4013-9F41-225B201A12D9(a)microsoft.com...
> I noticed high cpu usage with this function when it was used in a handler
> for
> a SerialPort. Using the string.replace method fixes the issue, but using
> a
> StringBuilder would be preferable to avoid generating garbage.
>
> Has anyone else had performance issues with this function on the compact
> framework? I've seen a few article that do comparisons between the
> StringBuilder, string, and regex replace methods, but none have observed
> this
> large performance gap I am seeing (cf vs. non-cf maybe?).
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4762 (20100111) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4762 (20100111) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com