Note that there are some explanatory texts on larger screens.

plurals
  1. POLambda slower with g++ 4.7 - faster with g++ 4.6
    primarykey
    data
    text
    <p>I was using g++ 4.7 because it's one of the latest release of g++ and it's the first one that adds a real support for <code>c++11</code>.</p> <p>For testing purpose I'm considering code taken <a href="https://stackoverflow.com/questions/8611756/why-c-lambda-is-slower-than-ordinary-function-when-called-multiple-times">from here</a>.</p> <p><a href="http://pastebin.com/33pR9nSf" rel="nofollow noreferrer">You can find the complete source code here.</a></p> <p>I name this source lambda.cpp and i compile it with:</p> <pre><code>g++-4.6 -std=c++0x lambda.cpp -o lambda46 g++-4.7 -std=c++11 lambda.cpp -o lambda47 </code></pre> <p>the lambda47 executable is about an half second slower than lambda46 when it comes to lambda performances, the surprise it's that the iterator part is usually faster than lambda46.</p> <p>I have also tried to use</p> <pre><code>g++-4.7 -std=c++0x lambda.cpp -o lambda47-0x </code></pre> <p>but basically g++-4.6 always generates faster code than g++-4.7.</p> <p>This is a common behaviour or it's a bug ?</p> <p>There is a compiler that will perform better with C++11 ?</p> <hr> <p>g++-4.7 it has been compiled with</p> <blockquote> <p>Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-4precise1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu</p> </blockquote> <p>g++-4.6 with</p> <blockquote> <p>Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload