Skip to content

compilation time and how to improve it #559

Description

@kwikius

Some comments re the current status here

I am thinking to propose mp-units for use with Ardupilot at some point (I think it might be a too hard sell but... ) and one subject that may come up is compilation time.

The following is maybe not a like for like comparison, but is only intended to get the ball rolling

I tested mp-units in the simplest possible compilation against my quan and pqs libraries. pqs came out on top with a compilation time of 2s. quan came out with a compilation time of 5s , but mp-units came out with a compilation time of 10s.

I hope that mp-units compilation time can be improved on ( sure maybe not using the examples below) , so how to do it?


#include <mp-units/systems/si/si.h>
#include <iostream>

int main()
{
   mp_units::quantity<mp_units::si::metre,float> length = { 1, mp_units::si::metre};

   float value = length.numerical_value_in( mp_units::si::metre);

   std::cout << value << '\n';

   return 0;
}
-------------- Build: Release in mp_units_test (compiler: GNU GCC13 Compiler)---------------

g++-13 -Wall -std=c++23 -O3 -I/home/andy/cpp/projects/mp-units/src/core/include -I/home/andy/cpp/projects/mp-units/src/systems/include -I/home/andy/cpp/projects/gsl-lite/include -c /home/andy/cpp/projects/mp_units_test/main.cpp -o obj/Release/main.o
g++  -o bin/Release/mp_units_test obj/Release/main.o  -s  
Output file is bin/Release/mp_units_test with size 14.17 KB
Process terminated with status 0 (0 minute(s), 10 second(s))
0 error(s), 0 warning(s) (0 minute(s), 10 second(s))
 
---------------------------------------------------------------------------------------------

#include <pqs/systems/si/length.hpp>
#include <iostream>

int main()
{
   pqs::si::length::m<float> length{1};

   float value = length.numeric_value();

   std::cout << value << '\n';

   return 0;
}

-------------- Build: Release in pqs (compiler: GNU GCC13 Compiler)---------------

g++-13 -Wall -std=c++23 -O3 -I/home/andy/cpp/projects/pqs/src/include -c /home/andy/cpp/projects/pqs/examples/test.cpp -o obj/Release/examples/test.o
g++  -o bin/Release/pqs obj/Release/examples/test.o  -s  
Output file is bin/Release/pqs with size 14.17 KB
Process terminated with status 0 (0 minute(s), 2 second(s))
0 error(s), 0 warning(s) (0 minute(s), 2 second(s))

------------------------------------------


#include <quan/length.hpp>
#include <iostream>

int main()
{
   quan::length_<float>::m length{1};

   float value = length.numeric_value();

   std::cout << value << '\n';

   return 0;
}

-------------- Build: Release in test (compiler: GNU GCC13 Compiler)---------------

g++-13 -Wall -std=c++23 -O3 -I/home/andy/cpp/projects/quan-trunk -c /home/andy/cpp/projects/test/main.cpp -o obj/Release/main.o
g++  -o bin/Release/test obj/Release/main.o  -s  
Output file is bin/Release/test with size 14.17 KB
Process terminated with status 0 (0 minute(s), 5 second(s))
0 error(s), 0 warning(s) (0 minute(s), 5 second(s))











 



Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions