Opened 12 years ago

Closed 10 years ago

#4700 closed Feature Requests (fixed)

Code bloat and slowing down compilation

Reported by: Ilya Murav'jov <muravev@…> Owned by: Samuel Krempp
Milestone: To Be Determined Component: format
Version: Boost 1.44.0 Severity: Optimization
Keywords: Cc: muravev@…

Description

  1. Function basic_format::operator%(const T& x) generate distinct bits for every type. It is too redundant to instantiate them for every "const char [N]"! For example, one for "a", one for "ab", one for "abc" and so on. Here is a patch:
        template<int N_>
        basic_format&   operator%(char const (&x)[N_])
            { return io::detail::feed<CharT, Tr, Alloc, char const * const&>(*this,(char const * const&)x); }

  1. I use Boost.Format for i18n (heavily); just #include <boost/format.hpp> and one (!) using of boost::format() gets over 400kb in object code and ~0.4 sec slowness (for gcc). So I want to include only <boost/format/format_class.hpp> (declaration only) and instantiate types in a distinct source.

But <boost/format/format_class.hpp> is not self all-sufficient. I have to include something like this:

#include <boost/config.hpp>

#ifndef BOOST_NO_STD_LOCALE
#include <locale>
#endif

#include <boost/format/format_class.hpp>

Fix it please.

Change History (2)

comment:1 by Steven Watanabe, 10 years ago

(In [80987]) Add #include <locale>. Refs #4700.

comment:2 by Steven Watanabe, 10 years ago

Resolution: fixed
Status: newclosed

(In [80989]) Reduce code bloat from boost::format. Fixes #4700.

Note: See TracTickets for help on using tickets.