N
not_a_commie
Using a synchronized Queue, I did some testing on catching the "queue
was empty on dequeue" exception vs. doing my own lock, checking for
empty, and then dequeuing. The try/catch method, though simpler in
code, was 100x slower than doing my own empty-check before dequeue.
That seems incredible to me that the try/catch handlers could be that
much slower than a lock and an empty check. It makes me want to go
through the codebase and rip out all the try-catch blocks that I
possibly can. Was it because I was running in the debugger? Would it
be better if I compiled in release mode?
was empty on dequeue" exception vs. doing my own lock, checking for
empty, and then dequeuing. The try/catch method, though simpler in
code, was 100x slower than doing my own empty-check before dequeue.
That seems incredible to me that the try/catch handlers could be that
much slower than a lock and an empty check. It makes me want to go
through the codebase and rip out all the try-catch blocks that I
possibly can. Was it because I was running in the debugger? Would it
be better if I compiled in release mode?