Skip to content

Massive compilation time degradation when upgrading to libBoost 1.68 #76

Open

Description

@PiotrZSL

After upgrading to libBoost 1.68 our compilation time of our project (3.1 m lines) deceased dramatically from ~45 min to ~1h 10min.

Deeper investigation points to this commit:

commit 71d797b9ee132b381c2d4f3b5bcca2078b0a5062
Author: Andrzej Krzemienski <akrzemi1@gmail.com>
Date:   Thu Jun 28 23:27:42 2018 +0200

    added implementation and tests of flat_map()

Compilation time of single file changes from 0m35.891s to 1m29.625s.
Same file compiled under other versions:

1.72:  1m28.077s
1.69:  1m26.839s
1.68:  1m30.255s
1.67:  0m26.357s
1.66:  0m26.683s

Our project heavily utilize boost::optional.
Tested on GCC 6.4 and GCC 8.

Commenting out "flat_map" methods reduces compilation time from 1m31.631s to 0m35.455s, commenting out additionally "map" method reduces compilation time even more back to 1.67 level (0m27.002s).

Please optimize these functions or add ability to exclude them from compilation.

Activity

  1. akrzemi1 commented on Nov 29, 2019

    @akrzemi1
    Member

    Thanks for reporting this.

    The solution I can thing of is to offer a macro that a user can choose to define, which disables the generation of member functions map() and flat_map(). Would this solution work for you?

  2. PiotrZSL commented on Nov 29, 2019

    @PiotrZSL
    Author

    Yes it would. But to be honest in project we are taking actions to get rid of boost::optional.

  3. MikeGitb commented on Dec 21, 2019

    @MikeGitb

    Any idea, why those functions slow down compilation so much? Shouldn't template member functions only be generated by the compiler if they are used?
    Or did that commit also add includes?

  4. PiotrZSL commented on Dec 21, 2019

    @PiotrZSL
    Author

    Not 100% sure but it may be connected with debug symbols on GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86964)

    Some tests were also done on GCC 9, and there such big slow down isn't visible.

  5. akrzemi1 commented on Sep 13, 2024

    @akrzemi1
    Member

    Changed the implementation for map and flat_map so that it does not rely on boost::result_of from Boost.Utility. This should speed up the compile times.

  6. akrzemi1 commented on Feb 18, 2026

    @akrzemi1
    Member

    How are the compilation times now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions