try and performance issues

B

Bit Byte

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 ? ..
 
R

Rolf Magnus

Bit said:
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.
 
J

Jerry Coffin

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,058
Members
48,769
Latest member
Clifft

Latest Threads

Top