Skip to content

improperly linking with -no-as-needed hurts performance #1

@kavon

Description

@kavon

As of commit 33f62e521e099c86a73b63de18da59b439662682

One would expect some sort of overhead when halo actually starts up the profiling.

However, the experiments below show that there is some sort of significant associated with just linking halomon.so into the executable even when halo's static constructor to start halomon is not run! Note that the -bare executable is the same thing, but we skip linking in halomon:

➤ time ./test/linear_hot-bare; echo -e "\n-----\n"; time ./test/linear_hot
7.31user 0.00system 0:07.31elapsed 100%CPU (0avgtext+0avgdata 1320maxresident)k
0inputs+0outputs (0major+57minor)pagefaults 0swaps

-----

Halo Running!
7.94user 0.00system 0:07.96elapsed 99%CPU (0avgtext+0avgdata 5696maxresident)k
0inputs+0outputs (0major+382minor)pagefaults 0swaps

In the above, halo was launched and received perf events. However, if we comment out the SystemMonitor declaration in monitor.cpp, then linking in halomon does nothing. Yet here are the results:

➤ time ./test/linear_hot-bare; echo -e "\n-----\n"; time ./test/linear_hot
7.34user 0.00system 0:07.34elapsed 99%CPU (0avgtext+0avgdata 1248maxresident)k
0inputs+0outputs (0major+57minor)pagefaults 0swaps

-----

7.96user 0.00system 0:07.96elapsed 100%CPU (0avgtext+0avgdata 5128maxresident)k
0inputs+0outputs (0major+355minor)pagefaults 0swaps

Interestingly, this large overhead doesn't appear when running the noop.cpp test, which is just a main function that immediately returns (in order to test the start-up and shutdown), even when Halo launches!

0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 1244maxresident)k
0inputs+0outputs (0major+56minor)pagefaults 0swaps

-----

Halo Running!
0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 5732maxresident)k
0inputs+0outputs (0major+372minor)pagefaults 0swaps

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