Boost logo

Boost :

Subject: [boost] [multiprecision]: 15% slowdown using -std=c++11 compiler flag
From: Kim Walisch (kim.walisch_at_[hidden])
Date: 2017-11-19 10:32:43


I have been investigating a 15% performance regression in my C++
primesum program (https://github.com/kimwalisch/primesum/tree/256-bit)
over the last 2 days.

By lots of benchmarking I was able to identify the boost
multiprecision library together with -std=c++11 (or -std=gnu++11)
as the culprit for the performance regression because I have also
a version of the primesum program which does not use the boost
multiprecision library and in this version there is no performance
regression when compiling using -std=c++11.

I have tested using multiple versions of the boost multiprecision
library including the latest 1.65.1. The slowdown happens on
both GCC (versions: 5.4, 6.4, 7.2) and Clang (version 3.8) on
x86_64 Linux. I am only using the int256_t and uint256_t types
(hence cpp_int backend) and I am doing only simple integer
arithmetic: +, - and *.

Is this a known issue and is there a known workaround e.g. special
compiler flag? I could revert to C++98 but I really don't want to do
that...

Thanks,
Kim Walisch


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk