try and performance issues

Discussion in 'C++' started by Bit Byte, Sep 13, 2006.

  1. Bit Byte

    Bit Byte Guest

    I am writing a messaging library which calls a method every few
    milliseconds to dispatch mesagaes awaiting in a queue.

    I wnat to wrap the method call with a try/catch, for more robust code,
    but I am wondering if there will be a noticeable performance hit ? ..
     
    Bit Byte, Sep 13, 2006
    #1
    1. Advertising

  2. Bit Byte

    Rolf Magnus Guest

    Bit Byte wrote:

    > I am writing a messaging library which calls a method every few
    > milliseconds to dispatch mesagaes awaiting in a queue.
    >
    > I wnat to wrap the method call with a try/catch, for more robust code,
    > but I am wondering if there will be a noticeable performance hit ? ..


    The best way to find out would be by measuring the performance for both
    variants. Note that this depends on the compiler and its optimization
    settings.
     
    Rolf Magnus, Sep 13, 2006
    #2
    1. Advertising

  3. Bit Byte

    Jerry Coffin Guest

    In article <>,
    says...
    > I am writing a messaging library which calls a method every few
    > milliseconds to dispatch mesagaes awaiting in a queue.
    >
    > I wnat to wrap the method call with a try/catch, for more robust code,
    > but I am wondering if there will be a noticeable performance hit ? ..


    You'll have to profile it with your implementation to know for sure, but
    many compilers have virtually no overhead until/unless an exception is
    actually thrown.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
     
    Jerry Coffin, Sep 13, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bienwell
    Replies:
    4
    Views:
    3,856
    bienwell
    May 27, 2005
  2. John Salerno
    Replies:
    20
    Views:
    859
    John Salerno
    Aug 11, 2006
  3. Fabio Z Tessitore

    who is simpler? try/except/else or try/except

    Fabio Z Tessitore, Aug 12, 2007, in forum: Python
    Replies:
    5
    Views:
    378
  4. =?Utf-8?B?QUo=?=

    When to TRY and not to TRY

    =?Utf-8?B?QUo=?=, Oct 16, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    330
    sloan
    Oct 17, 2007
  5. MRAB
    Replies:
    4
    Views:
    311
Loading...

Share This Page