Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-93760

Consider enabling -fvisibility-inlines-hidden to improve startup time of dynamic builds

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Build

      As an experiment, I looked at a small library and was surprised to find over 1k symbols defined.

       

      > readelf --dyn-syms -C -W build/install/lib/libcqf_utils.so | wc -l
      1122

      This turns out to be the case because the default visibility of symbols is public, which means that at load time, the dynamic loader needs to iterate over all these symbols to resolve relocations for them.

      I attempted to recompile the same library with -fvisibility-inlines-hidden, which marks inlined class member functions as having private visibility, and saw that it only had ~200 symbols instead.

      When I compiled the server with and without this option, I tested start up times. On my machine, mongod startup time dropped from ~12s to ~5s. Given max.hirschhorn@mongodb.com's findings about the about of time CI spends on mongod startup, this could be a nice win for testing times.

      It looks like a prior investigation into using this option, SERVER-49322, was abandoned. The main issue appears to be concern about how hidden symbols would affect other tools which depend on the ability to symbolized stack traces, like the heap profiler, invariants, sanitizers etc. Given the potential improvements, I think it warrants further investigation into whether these concerns could be addressed or are still relevant after our move to libunwind.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: