Le 22.10.2013 23:01, Jerry Stuckle a écrit :
On 10/21/2013 5:26 PM, berenger.morel@neutralite.org wrote:
Le 18.10.2013 19:36, Jerry Stuckle a écrit :
[...]
Even inlined code requires resources to execute. It is NOT as
fast
as regular C pointers.
I did some testing, to be sure. With -O3, the code is exactly the
same.
Did not tried with -O1 and -O2. Without optimization, the 5 lines
with
pointers were half sized of those using unique_ptr. But I never
ship
softwares not optimized (the level depends on my needs, and
usually I do
not use -O3, though).
First of all, with the -O1 and -O2 optimization you got extra code.
Did you try it? It just did, with a code doing simply a new and a
delete
with raw against unique_ptr. In short, the simplest usage possible.
Numbers are optimization level, p means pointer and u means
unique_ptr.
It seems that it is the 2nd level of optimization which removes the
difference.
7244 oct. 23 01:57 p0.out
6845 oct. 23 01:58 p1.out
6845 oct. 23 01:58 p2.out
6845 oct. 23 01:58 p3.out
11690 oct. 23 01:59 u0.out
10343 oct. 23 01:59 u1.out
6845 oct. 23 01:59 u2.out
6845 oct. 23 01:59 u3.out