Subject: [Boost-bugs] [Boost C++ Libraries] #9232: Template bloat
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-11 13:18:12
#9232: Template bloat
------------------------------+----------------------------
Reporter: psiha | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
Version: Boost 1.54.0 | Severity: Optimization
Keywords: |
------------------------------+----------------------------
With integers of size N powm() will instantiate divide_unsigned_helper<>
for N and N*2, since this is a very large function this leads to classical
template bloat.
Examining the codegen it appears that both instantiations are nearly
identical save for immediate constants -> this would suggest that you
could refactor divide_unsigned_helper<> (and probably the rest of the
library) so that it separates functionality that actually depends on
template parameters from template-parameter independent code into separate
functions (in this case divide_unsigned_helper would probably call a
helper function that takes the size of the number as a runtime parameter).
ps. even when different function template instantiations result in
identical code there are _still_ lousy compilers&linkers that will not
merge them (Clang we are looking at you:
http://llvm.org/bugs/show_bug.cgi?id=11633)...
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9232> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC