all groups > dotnet performance > september 2006 >
You're in the

dotnet performance

group:

Trace.Write.....


Trace.Write..... greg
9/28/2006 11:05:48 AM
dotnet performance:
Hi all,

I'm using Trace.Write all over my code and I was wondering whether it has
any performance implications when there is no listener added in the config
file.

I'm using the following syntax to remove all listeners.
<listeners>

<remove name="Default" />

<clear />

</listeners>


Many thanks in advance,
Greg.

Re: Trace.Write..... Laura T
9/28/2006 5:27:32 PM
It has SOME performance implications, since there will allways be the CALLs
to check if there are trace listeners.
Most of it is at the first Trace.Write because the system must load .config
and analyze it. After that it's not much.
There will be a few instructions still that it are needed every time, but
very few.


"greg" <gggasteratos@metastorm.no.spam.com> ha scritto nel messaggio
news:e%23htuWu4GHA.1492@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

Re: Trace.Write..... greg
10/2/2006 12:00:00 AM
Many thanks Laura,
Greg.

Re: Trace.Write..... Ben Voigt
10/5/2006 4:36:01 PM

[quoted text, click to view]

It also depends on how you call Trace.Write()...
Any method or properties referred to still have to be executed to put the
argument on the stack. If you use string concatenation instead of "{0}"
placeholders then the objects all have to be converted to string and
concatenated even though the result will be ignored.

It may be almost as expensive as having a listener.

Debug.Write saves a lot more in a release build because the Debug.Write
method is marked as conditional and the compiler can perform expression
live-ness analysis to remove some computation.

[quoted text, click to view]

AddThis Social Bookmark Button