views:

68

answers:

2

Hi guys, I'm profiling a recent program that is dominated with File read. I'm kind of confused on how to interpret the results. If someone could explain to me what these top four functions are, it would help me a lot. Thanks in advance!

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 25.00      0.95     0.95                             _Unwind_SjLj_Register
 15.79      1.55     0.60                             std::num_get<char, std::istreambuf_iterator<char, std::char_traits<char> > >::_M_extract_float(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, std::string&) const
 10.26      1.94     0.39                             std::string::_M_mutate(unsigned int, unsigned int, unsigned int)
 10.00      2.32     0.38                             _Unwind_SjLj_Unregister
+3  A: 

The first and last are for exception handling; they are generated by the compiler to register objects whose destructors must be called if an exception leaves the current scope. You might be able to avoid calls to these functions if you can restructure your code to avoid throwing exceptions, or calling functions that might throw, during the lifetime of objects with non-trivial destructors. This often isn't possible, though.

The second is the internal function for parsing a float value from an input stream.

The third is the internal function for resizing a string, perhaps one used internally when parsing the stream.

Mike Seymour
Ahh thanks. Yeah I'm using a ifstream to read in around 700k floats from a file. Maybe I should try a scanf instead... Thanks
Xzhsh
Please post and let me know if that makes your code faster.
Zachary Vance
+1  A: 

num_get is used in the conversion from strings t numbers, and the mutate function I would guess is somehow changing the size of a string. so I would guess your program is reading strings and converting them into numbers. The Unwind stuff I would guess is something to do with exception handling. Can't say more without seeing code.

anon