From fa7b55fc4ba50bde3f1de8e40a56ef70d9116595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oona=20R=C3=A4is=C3=A4nen?= Date: Sat, 28 Dec 2024 09:15:00 +0200 Subject: [PATCH] Small improvement to compilation time Compile the event list into its own object file and forward-declare --- .github/workflows/build.yml | 2 +- CHANGES.md | 1 + README.md | 3 +++ meson.build | 1 + src/tmc/events.h | 16 ++++++++++++++++ src/tmc/{event_list.h => events_data.cc} | 4 +--- src/tmc/tmc.cc | 2 +- 7 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 src/tmc/events.h rename src/tmc/{event_list.h => events_data.cc} (99%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c611334..544d516 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: build on: push: - branches: [ master ] + branches: [ master, dev-dont-use ] tags: [ 'v*' ] pull_request: branches: [ master ] diff --git a/CHANGES.md b/CHANGES.md index bad4e37..8927b17 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ * Build system fixes: * macOS: ask Homebrew about liquid-dsp location instead of hardcoding it * Set default installation prefix to /usr/local (all platforms) + * Reduce compiler workload somewhat with forward declarations ## 1.0.1 (2024-07-19) diff --git a/README.md b/README.md index b45561d..c450656 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ line instead of `meson compile` to limit the number of build processes: $ taskset -c 0 meson compile +The compilation will still require at least 500 MB of free RAM. + ## Usage Redsea reads an MPX signal from stdin by default. It expects the input @@ -217,6 +219,7 @@ redsea -f WAVEFILE * Linux/macOS/Cygwin/MSYS2+MinGW * C++14 compiler * meson + ninja +* 500 MB of free memory for non-parallel build ([breakdown](https://github.com/windytan/redsea/issues/120#issuecomment-2559254338)) ### Testing diff --git a/meson.build b/meson.build index 7fd67cb..17e2316 100644 --- a/meson.build +++ b/meson.build @@ -103,6 +103,7 @@ sources_no_main = [ 'src/rdsstring.cc', 'src/tables.cc', 'src/tmc/csv.cc', + 'src/tmc/events_data.cc', 'src/tmc/tmc.cc', 'src/tmc/locationdb.cc', 'src/util.cc', diff --git a/src/tmc/events.h b/src/tmc/events.h new file mode 100644 index 0000000..873beec --- /dev/null +++ b/src/tmc/events.h @@ -0,0 +1,16 @@ +#ifndef TMC_EVENTS_H_ +#define TMC_EVENTS_H_ + +#include +#include + +namespace redsea { +namespace tmc { + +extern const std::array tmc_data_events; +extern const std::array tmc_data_suppl; + +} // namespace tmc +} // namespace redsea + +#endif // TMC_EVENTS_H_ diff --git a/src/tmc/event_list.h b/src/tmc/events_data.cc similarity index 99% rename from src/tmc/event_list.h rename to src/tmc/events_data.cc index 7d38a5b..1b29260 100644 --- a/src/tmc/event_list.h +++ b/src/tmc/events_data.cc @@ -1,5 +1,4 @@ -#ifndef TMC_EVENT_LIST_H_ -#define TMC_EVENT_LIST_H_ +#include "events.h" #include #include @@ -1801,4 +1800,3 @@ const std::array tmc_data_suppl{ } // namespace tmc } // namespace redsea -#endif // TMC_EVENT_LIST_H_ diff --git a/src/tmc/tmc.cc b/src/tmc/tmc.cc index 85d4699..827f55a 100644 --- a/src/tmc/tmc.cc +++ b/src/tmc/tmc.cc @@ -33,7 +33,7 @@ #include "src/common.h" #include "src/tables.h" #include "src/tmc/csv.h" -#include "src/tmc/event_list.h" +#include "src/tmc/events.h" #include "src/tmc/locationdb.h" namespace redsea {