Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Tracing - Perfomance impact.

Tracing - Perfomance impact.

Scheduled Pinned Locked Moved C#
performance
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 2322509
    wrote on last edited by
    #1

    Hello all, I am planning to add Tracing instrumentation to our application. This would result in tons of adding Tracing and logging statements in almost all methods of main areas of application. Even when tracing is disabled, at minimum these statements would atleast evaluate TracingEnabled==False/True logic, which i think will have some performance impact. Any better ideas are appreciated. Thanks.

    modified on Friday, November 14, 2008 12:15 PM

    C W S P 4 Replies Last reply
    0
    • U User 2322509

      Hello all, I am planning to add Tracing instrumentation to our application. This would result in tons of adding Tracing and logging statements in almost all methods of main areas of application. Even when tracing is disabled, at minimum these statements would atleast evaluate TracingEnabled==False/True logic, which i think will have some performance impact. Any better ideas are appreciated. Thanks.

      modified on Friday, November 14, 2008 12:15 PM

      C Offline
      C Offline
      carbon_golem
      wrote on last edited by
      #2

      You might want to look at Log4Net and/or an AOP framework like PostSharp. It's hard to say what the actual timing impact will be, but something like this seems more of a performance issue in actually doing the instrumentation IMHO. Scott P

      "Simplicity carried to the extreme becomes elegance."
      -Jon Franklin

      1 Reply Last reply
      0
      • U User 2322509

        Hello all, I am planning to add Tracing instrumentation to our application. This would result in tons of adding Tracing and logging statements in almost all methods of main areas of application. Even when tracing is disabled, at minimum these statements would atleast evaluate TracingEnabled==False/True logic, which i think will have some performance impact. Any better ideas are appreciated. Thanks.

        modified on Friday, November 14, 2008 12:15 PM

        W Offline
        W Offline
        Wendelius
        wrote on last edited by
        #3

        If you can control this behaviour using different builds, you might use ConditionalAttribute Class[^]

        The need to optimize rises from a bad design. My articles[^]

        1 Reply Last reply
        0
        • U User 2322509

          Hello all, I am planning to add Tracing instrumentation to our application. This would result in tons of adding Tracing and logging statements in almost all methods of main areas of application. Even when tracing is disabled, at minimum these statements would atleast evaluate TracingEnabled==False/True logic, which i think will have some performance impact. Any better ideas are appreciated. Thanks.

          modified on Friday, November 14, 2008 12:15 PM

          S Offline
          S Offline
          Scott Bruno
          wrote on last edited by
          #4

          This doesn't help you right now, but you could beg Microsoft to include useful things like proper preprocessor macros the next time they make a programming language. You could fudge it, sorta' like this: void Breakpoint() { #if _BREAK_ENABLED System.Diagnostics.Debugger.Break(); #endif } I'm pretty sure that calls to empty function bodies are effectively eliminated by the time the JIT comes into play, but I could be wrong.

          -- Abort, Retry, Hurl computer into the hellfire in which it was forged?

          G 1 Reply Last reply
          0
          • U User 2322509

            Hello all, I am planning to add Tracing instrumentation to our application. This would result in tons of adding Tracing and logging statements in almost all methods of main areas of application. Even when tracing is disabled, at minimum these statements would atleast evaluate TracingEnabled==False/True logic, which i think will have some performance impact. Any better ideas are appreciated. Thanks.

            modified on Friday, November 14, 2008 12:15 PM

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            If you're using .NET 3, I'd consider using Partial methods and the Conditional attribute. A better bet though would be to use Inversion of Control to implement the tracing only when it's needed. Take a look at the Unity framework for more information/details.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles | MoXAML PowerToys

            U 1 Reply Last reply
            0
            • P Pete OHanlon

              If you're using .NET 3, I'd consider using Partial methods and the Conditional attribute. A better bet though would be to use Inversion of Control to implement the tracing only when it's needed. Take a look at the Unity framework for more information/details.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles | MoXAML PowerToys

              U Offline
              U Offline
              User 2322509
              wrote on last edited by
              #6

              Thanks all you guys. I will take look at unity framework, which Pete suggested.

              1 Reply Last reply
              0
              • S Scott Bruno

                This doesn't help you right now, but you could beg Microsoft to include useful things like proper preprocessor macros the next time they make a programming language. You could fudge it, sorta' like this: void Breakpoint() { #if _BREAK_ENABLED System.Diagnostics.Debugger.Break(); #endif } I'm pretty sure that calls to empty function bodies are effectively eliminated by the time the JIT comes into play, but I could be wrong.

                -- Abort, Retry, Hurl computer into the hellfire in which it was forged?

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Scott Bruno wrote:

                you could beg Microsoft to include useful things like proper preprocessor macros the next time they make a programming language

                It was a deliberate decision to avoid preprocessor macros when the C# language was designed. You can do a lot with them, but they are widely used in ways that make it harder to understand the code, which is the opposite of the philosophy of the C# language.

                Despite everything, the person most likely to be fooling you next is yourself.

                S 1 Reply Last reply
                0
                • G Guffa

                  Scott Bruno wrote:

                  you could beg Microsoft to include useful things like proper preprocessor macros the next time they make a programming language

                  It was a deliberate decision to avoid preprocessor macros when the C# language was designed. You can do a lot with them, but they are widely used in ways that make it harder to understand the code, which is the opposite of the philosophy of the C# language.

                  Despite everything, the person most likely to be fooling you next is yourself.

                  S Offline
                  S Offline
                  Scott Bruno
                  wrote on last edited by
                  #8

                  Guffa wrote:

                  It was a deliberate decision

                  Oh really? And all this time I thought it was accidental. :rolleyes: I know why they did it. I just disagree with the practice of neutering languages in an attempt to open up platform development to the less capable.

                  -- Abort, Retry, Hurl computer into the hellfire in which it was forged?

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups