Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::function performance issues with C++11
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-07-08 02:58:48


2014-07-08 4:28 GMT+04:00 饭桶 <athrun911500_at_[hidden]>:

> Hi, there,
> Thanks for you guys help. I think I have reached the answer I wanted. So
> I'd like to explain why there are performance issues with C++11 in
> boost::function.
> First of all, I wanna reply the guys who give me hints.
>
> >> What if you try with just 1 integer? Does the difference in time stay
> proportionally the same?
> There won't be big differences if there is just 1 integer. So this proofs
> that it could be a memory copy problem.
>
> >> I'd run the example code through Callgrind (valgrind --tool=callgrind)
> >> and then compare the reports in KCachegrind. This should at least give
> >> you an idea of the source of the problem.
> You are right. I ran callgrind, and it showed some interesting things. If
> I compiled without C++11, it shows the most hot spot is
> "wordcopy_fwd_align". Otherwise, the most hotspot is "boost::bind" and
> there is no records for wordcopy_fwd_align. I think that means if we dont'
> use C++11, there will be some memory copy optimizations.
>
> >> Maybe trying another compiler would help you obtain your "proof".
> >> How about intel compiler?
> >> It also has the "-std=c++11" flag, so, if it is a compiler issue it
> will be clear.
> As you suggested, I tried Intel compiler. It's great. The data shows there
> is no performance differences between with or without C++11 in
> boost::function. That proofs your guess that it's a compiler issue.
>
> So here is my conclusion, there won't be memory copy optimization when
> using (C++11, boost::function, gcc4.9/clang3.4). But Intel compiler does
> well to do C++11 related optimizations.
>

Could you please create a ticket in GCC's bugzilla for this issue? Post the
most interesting parts of this discussion in that ticket and then post a
link to the ticket in this mailing list.

Thanks in advance!

-- 
Best regards,
Antony Polukhin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net