So I've used gprof
to analyze my C++ code. The top three that make my code lag are as follows:
% cumulative self self total
time seconds seconds calls ms/call ms/call name
66.00 521.93 521.93 12674073276 0.00 0.00 std::_List_const_iterator<std::unique_ptr<Msg, std::default_delete<Msg> > >::operator++()
13.63 629.70 107.77 _mcount_private
9.47 704.63 74.93 __fentry__
I guess the second and the third are from gprof
itself. But what does std::_List_const_iterator<std::unique_ptr<Msg, std::default_delete<Msg> > >::operator++()
really mean? And why this causes slowness?
For reference, I have two important member variables:
std::list<std::unique_ptr<struct A> > queue_1;
std::vector<std::deque<std::list<std::unique_ptr<struct A> >::iterator > > queue_2;
So queue_2
is to store iterators to queue_1
. There is supposed to be frequent push_back()
and element deletions applied to the two queues.