Troubleshooting

I am considering using exception formatting in my application. The main benefit of implementing redundant exception handling is that I can add metadata to the exceptions. This can facilitate debugging and allow the propagation of more information upward as exception stacks are unwound. However, I do not understand how this will affect performance. How optimization of exception handling is implemented - Error_info objects are stored on the map inside (with insert log (n) for each insert)! Any known flaws in exception handling!

+4
source share
2 answers

As you already mentioned, as far as I can see, the next load accompanies the operator <

  • new error_info to initialize shared_ptr< error_info >

  • new exception_detail::error_info_container_impl to initialize intrusive_ptr< exception_detail::error_info_container>

  • operator[] to insert them into std::map< typeinfo, shared_ptr<error_info_base const> >

I can’t say whether these loads affect your situation. If you are concerned, it would be better to measure the load in the actual environment.

+4
source

Yes, error information is stored on the map. The cost of inserting error_info is negligible both in terms of speed (flushing and spinning the stack is probably much slower) and space (all memory is fixed at the end of the catch, usually shortly after all other memory is freed up as it is deleted) stack).

0
source

Source: https://habr.com/ru/post/1333660/


All Articles