Public bug reported: I started to use Ubuntu 16.04 with gcc 5.3.1-14ubuntu2.1, libc 2.23-0ubuntu3. And I wrote a simple program:
#include <cmath> #include <iostream> #include <chrono> #define CYCLE_NUM 1E+7 using namespace std; using namespace std::chrono; int main() { double sum = 0.0; auto t1 = high_resolution_clock::now(); for(int i = 1; i < CYCLE_NUM; i++) { sum += sin((double)(i)) / (double)(i); } auto t2 = high_resolution_clock::now(); microseconds::rep t = duration_cast<microseconds>(t2-t1).count(); cout << "sum = " << sum << endl; cout << "time = " << (double)(t) / 1.E+6 << endl; return 0; } which compiled with command: g++ -std=c++11 -O3 main.cpp -o sum This program work 2.5 times slower than the same program in Ubuntu 14.04.3 with gcc 4.8.4 libc-2.19 compiled with the same command. I've tried to compile the same code in VS C++ 2015 with the same level of optimization and I've got almost the same time as I've got in Ubuntu 14.04 (gcc 4.8.4 libc-2.19). My proc is i7-5820, haswell. It seems that math functions (no only sin, also cos, exp) now process significantly slower compared to older versions of c++ libraries or compiler. I've created topic on stackoverflow.com : http://stackoverflow.com/questions/38172066/the-program-works-3-times-slower-compiled-with-g-5-3-1-than-the-same-program-c ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: libc-bin 2.23-0ubuntu3 ProcVersionSignature: Ubuntu 4.4.0-28.47-generic 4.4.13 Uname: Linux 4.4.0-28-generic x86_64 NonfreeKernelModules: nvidia_uvm nvidia_modeset nvidia ApportVersion: 2.20.1-0ubuntu2.1 Architecture: amd64 CurrentDesktop: Unity Date: Sun Jul 3 23:24:33 2016 Dependencies: gcc-6-base 6.0.1-0ubuntu1 libc6 2.23-0ubuntu3 libgcc1 1:6.0.1-0ubuntu1 InstallationDate: Installed on 2016-07-02 (1 days ago) InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1) SourcePackage: glibc UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: glibc (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug xenial ** Attachment added: "Assembler & preprocessed listings of programm pointed in message" https://bugs.launchpad.net/bugs/1598618/+attachment/4694855/+files/asm_preprocessed_listing.tar.gz -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1598618 Title: Math calls to libc-2.23 compiled with g++ 5.3.1 (Ubuntu 16.04) process 2.5 time slower compared to libc-2.19 compiled with g++ 4.8.4 (Ubuntu 14.04) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1598618/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs