Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significantly (23 to 33%) faster builds of qgis_core/analysis/3d/gui/app/server #59667

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

rouault
Copy link
Contributor

@rouault rouault commented Nov 30, 2024

by precompiling qgis.h

Needs to be precompiled for each target due to different includes, defines, etc. (~ 4 second for each target to build the precompiled header in below timings)

Executive summary:

  • ~ 33% faster builds on ubuntu 22.04, QT5
  • ~ 23% faster builds (only measured on qgis_core) on fedora:rawhide, QT6
  • build artifact increase size: + ~7%
  • shared library increase size: + 1% at most

Setup: laptop with Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, host OS Ubuntu 20.04, QGIS built in Docker
ccache and ${build_dir}/src/{component} directories emptied before each build

Details:

  • ubuntu 22.04, QT5, regular, CMAKE_BUILD_TYPE=Debug
$ time make -j12 qgis_core
real	9m8.566s
user	90m24.917s
sys	    9m51.179s

$ du -c src/core | tail -n 1
1994796	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 590223936 Nov 30 00:35 ./output/lib/libqgis_core.so.3.41.0*
$ time make -j12 qgis_gui
real	8m26.430s
user	80m28.457s
sys	    11m27.936s

$ du -c src/gui | tail -n 1
1538440	total

$ ll ./output/lib/libqgis_gui.so.3.41.0
-rwxr-xr-x 1 root root 454560448 Nov 30 00:47 ./output/lib/libqgis_gui.so.3.41.0*
$ time make -j12 qgis_app
real	4m55.189s
user	47m4.876s
sys	    6m54.868s

$ du -c src/app | tail -n 1
783256	total

$ ll ./output/lib/libqgis_app.so.3.41.0
-rwxr-xr-x 1 root root 232041152 Nov 30 01:25 ./output/lib/libqgis_app.so.3.41.0*
  • ubuntu 22.04, QT5, qgis.h as precompiled header, CMAKE_BUILD_TYPE=Debug:
$ time make -j12 qgis_core
real	6m3.472s
user	59m3.835s
sys	    5m22.424s

$ du -c src/core | tail -n 1
2137448	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 598395456 Nov 30 00:56 ./output/lib/libqgis_core.so.3.41.0*
$ time make -j12 qgis_gui
real	5m45.719s
user	53m30.107s
sys	    6m11.246s

$ du -c src/gui | tail -n 1
1660444	total

$ ll ./output/lib/libqgis_gui.so.3.41.0
-rwxr-xr-x 1 root root 456432320 Nov 30 01:04 ./output/lib/libqgis_gui.so.3.41.0*
$ time make -j12 qgis_analysis
real	2m36.504s
user	26m25.310s
sys	    2m17.601s

$ du -c src/analysis/ | tail -n 1
920912	total

$ ll ./output/lib/libqgis_analysis.so.3.41.0
-rwxr-xr-x 1 root root 228178496 Nov 30 01:11 ./output/lib/libqgis_analysis.so.3.41.0*
$ time make -j12 qgis_3d
real	0m43.710s
user	6m9.148s
sys	    0m39.859s

$ du -c src/3d | tail -n 1
315212	total

$ ll ./output/lib/libqgis_3d.so.3.41.0
-rwxr-xr-x 1 root root 58472960 Nov 30 01:14 ./output/lib/libqgis_3d.so.3.41.0*
$ time make -j12 qgis_app
real	3m35.156s
user	34m17.371s
sys	    3m52.111s

$ du -c src/app | tail -n 1
905160	total

$ ll ./output/lib/libqgis_app.so.3.41.0
-rwxr-xr-x 1 root root 232577728 Nov 30 01:19 ./output/lib/libqgis_app.so.3.41.0*
  • fedora:rawhide, QT6, regular, CMAKE_BUILD_TYPE=Debug:
$ time ninja qgis_core
real	13m47.521s
user	134m48.546s
sys	    10m2.176s

$ du -c src/core | tail -n 1
2862200	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 824605072 Nov 30 00:53 ./output/lib/libqgis_core.so.3.41.0
  • fedora:rawhide, QT6, qgis.h as precompiled header, CMAKE_BUILD_TYPE=Debug:
$ time ninja qgis_core
real	10m35.657s
user	97m51.161s
sys	    7m59.564s

$ du -c src/core | tail -n 1
3028420	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 825732184 Nov 30 00:38 ./output/lib/libqgis_core.so.3.41.0

@github-actions github-actions bot added this to the 3.42.0 milestone Nov 30, 2024
by precompiling qgis.h

Needs to be precompiled for each target due to different includes, defines, etc. (~ 4 second for each target to build the precompiled header in below timings)

Executive summary:
- ~ 33% faster builds on ubuntu 22.04, QT5
- ~ 23% faster builds (only measured on qgis_core) on fedora:rawhide, QT6
- build artifact increase size: + ~7%
- shared library increase size: + 1% at most

Setup: laptop with Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, host OS Ubuntu 20.04,
QGIS built in Docker

Details:

* ubuntu 22.04, QT5, regular, CMAKE_BUILD_TYPE=Debug

```bash
$ time make -j12 qgis_core
real	9m8.566s
user	90m24.917s
sys	    9m51.179s

$ du -c src/core | tail -n 1
1994796	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 590223936 Nov 30 00:35 ./output/lib/libqgis_core.so.3.41.0*
```

```bash
$ time make -j12 qgis_gui
real	8m26.430s
user	80m28.457s
sys	    11m27.936s

$ du -c src/gui | tail -n 1
1538440	total

$ ll ./output/lib/libqgis_gui.so.3.41.0
-rwxr-xr-x 1 root root 454560448 Nov 30 00:47 ./output/lib/libqgis_gui.so.3.41.0*
```

```bash
$ time make -j12 qgis_app
real	4m55.189s
user	47m4.876s
sys	    6m54.868s

$ du -c src/app | tail -n 1
783256	total

$ ll ./output/lib/libqgis_app.so.3.41.0
-rwxr-xr-x 1 root root 232041152 Nov 30 01:25 ./output/lib/libqgis_app.so.3.41.0*
```

* ubuntu 22.04, QT5, qgis.h as precompiled header, CMAKE_BUILD_TYPE=Debug:

```bash
$ time make -j12 qgis_core
real	6m3.472s
user	59m3.835s
sys	    5m22.424s

$ du -c src/core | tail -n 1
2137448	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 598395456 Nov 30 00:56 ./output/lib/libqgis_core.so.3.41.0*
```

```bash
$ time make -j12 qgis_gui
real	5m45.719s
user	53m30.107s
sys	    6m11.246s

$ du -c src/gui | tail -n 1
1660444	total

$ ll ./output/lib/libqgis_gui.so.3.41.0
-rwxr-xr-x 1 root root 456432320 Nov 30 01:04 ./output/lib/libqgis_gui.so.3.41.0*
```

```bash
$ time make -j12 qgis_analysis
real	2m36.504s
user	26m25.310s
sys	    2m17.601s

$ du -c src/analysis/ | tail -n 1
920912	total

$ ll ./output/lib/libqgis_analysis.so.3.41.0
-rwxr-xr-x 1 root root 228178496 Nov 30 01:11 ./output/lib/libqgis_analysis.so.3.41.0*
```

```bash
$ time make -j12 qgis_3d
real	0m43.710s
user	6m9.148s
sys	    0m39.859s

$ du -c src/3d | tail -n 1
315212	total

$ ll ./output/lib/libqgis_3d.so.3.41.0
-rwxr-xr-x 1 root root 58472960 Nov 30 01:14 ./output/lib/libqgis_3d.so.3.41.0*
```

```bash
$ time make -j12 qgis_app
real	3m35.156s
user	34m17.371s
sys	    3m52.111s

$ du -c src/app | tail -n 1
905160	total

$ ll ./output/lib/libqgis_app.so.3.41.0
-rwxr-xr-x 1 root root 232577728 Nov 30 01:19 ./output/lib/libqgis_app.so.3.41.0*
```

* fedora:rawhide, QT6, regular, CMAKE_BUILD_TYPE=Debug:

```bash
$ time ninja qgis_core
real	13m47.521s
user	134m48.546s
sys	    10m2.176s

$ du -c src/core | tail -n 1
2862200	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 824605072 Nov 30 00:53 ./output/lib/libqgis_core.so.3.41.0

```

* fedora:rawhide, QT6, qgis.h as precompiled header, CMAKE_BUILD_TYPE=Debug:

```bash
$ time ninja qgis_core
real	10m35.657s
user	97m51.161s
sys	    7m59.564s

$ du -c src/core | tail -n 1
3028420	total

$ ll ./output/lib/libqgis_core.so.3.41.0
-rwxr-xr-x 1 root root 825732184 Nov 30 00:38 ./output/lib/libqgis_core.so.3.41.0
```
@rouault rouault force-pushed the qgis_precompiled_headers branch from aa2f3c6 to f9ae507 Compare November 30, 2024 01:05
Copy link

github-actions bot commented Nov 30, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit d698e77)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit d698e77)

@nyalldawson
Copy link
Collaborator

Is this worth doing for src/server too? Great work!!

@rouault
Copy link
Contributor Author

rouault commented Nov 30, 2024

Is this worth doing for src/server too? Great work!!

Done. Most certainly given the consistency of benefits on other components (I'd say there's a benefit for any target with more than 10 .cpp files)

@rouault rouault changed the title Significantly (23 to 33%) faster builds of qgis_core/analysis/3d/gui/app Significantly (23 to 33%) faster builds of qgis_core/analysis/3d/gui/app/server Nov 30, 2024
@nyalldawson nyalldawson merged commit 3c143d5 into qgis:master Nov 30, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants