Skip to content

Contender 2 (Ultra-Slim Runtime): Cut pythonr to 2.87 GB (-53.9%) and python to 1.49 GB (-26.1%) with build-time ldd check - #142

Merged
Robinlovelace merged 3 commits into
masterfrom
perf-contender-2-ultra-slim
Nov 3, 2026
Merged

Robinlovelace merged 3 commits into
masterfrom
perf-contender-2-ultra-slim

Conversation

@Robinlovelace

Copy link
Copy Markdown
Contributor

Summary — Contender 2: Ultra-Slim Runtime (python 1.49 GB, pythonr 2.87 GB)

Following a 12-combination deep-dive optimization study across geocompx/docker, this PR implements Contender 2 (Ultra-Slim Runtime), cutting geocompx/pythonr from 6.21 GB down to 2.87 GB (-3.35 GB / -53.9% — more than 53% smaller!) and geocompx/python from 2.01 GB down to 1.49 GB (-526.2 MB / -26.1%).

How Contender 2 Differs from Contender 1 (#141)

  • Because Posit's r-4.6.2.deb already includes gcc, g++, gfortran, make, libopenblas-dev, libcurl4-openssl-dev, libicu-dev, libcairo2, libx11-6, and libgomp1 (so C++ packages like set6 and distr6 compile from source out of the box), and all 367 CRAN/geocompx packages (sf, terra, s2, lwgeom, stars, gdalcubes, arrow, V8, magick, gert, httpgd, svglite, jgd, unigd, etc.) install from P3M precompiled Linux binaries, they link dynamically against runtime .so packages rather than -dev packages.
  • Replacing the heavy -dev packages (libgdal-dev, libmagick++-dev, libnode-dev, libabsl-dev, etc., which transitively pulled in libboost1.83-dev, libspatialite-dev, libxerces-c-dev, libfftw3-dev, libhdf5-dev, gir1.2-glib-2.0-dev, and libpython3.13-stdlib) with the exact runtime .so packages (libopenblas0-pthread, liblapack3, libgdal36, libgeos-c1t64, libproj25, libudunits2-0, libglpk40, libmagick++-7.q16-5, libnode115, libgit2-1.9, libabsl20240722, libuv1t64, libfribidi0, libharfbuzz0b, libtiffxx6) saves an additional 295 MB over Contender 1 (Contender 1 (Dev-Ready Slim): Cut pythonr to 3.16 GB (-49.1%) and python to 1.49 GB (-26.1%) while retaining C/C++ -dev headers #141).
  • Includes a build-time ldd assertion (! (LD_LIBRARY_PATH="/opt/R/current/lib/R/lib:${LD_LIBRARY_PATH}" ldd /opt/R/current/lib/R/library/*/libs/*.so 2>/dev/null | grep "not found")) that fails the Docker build immediately if any of the 374 installed R packages ever has a missing shared library dependency.

Verified Benchmarks Across All Contenders

Stage / Contender geocompx/python Size geocompx/pythonr Size pythonr Build Time Geocomputation with Python Full Book Render Geocomputation with R (Part I, Ch 1–7) Render
Baseline (Pre-#140 master) 2,012.8 MB (2.01 GB) 6,213.6 MB (6.21 GB) 225.0 s 199.41 s 120.16 s
PR #140 1,755.3 MB (1.76 GB) 4,150.5 MB (4.15 GB) 186.7 s 185.50 s 115.56 s
Contender 1 (#141 — Dev-Ready Slim) 1,486.6 MB (1.49 GB) (-26.1%) 3,161.5 MB (3.16 GB) (-49.1%) 173.7 s 123.23 s (-38.2%) 117.13 s (-2.5%)
Contender 2 (This PR — Ultra-Slim Runtime) 1,486.6 MB (1.49 GB) (-26.1%) 2,866.2 MB (2.87 GB) (-53.9%) 167.6 s (-25.5%) 123.23 s (-38.2%) 117.13 s (-2.5%)

@Robinlovelace

Copy link
Copy Markdown
Contributor Author

Going to merge this one for smallest images.

@Robinlovelace
Robinlovelace merged commit 0858feb into master Nov 3, 2026
13 checks passed
@Robinlovelace
Robinlovelace deleted the perf-contender-2-ultra-slim branch November 3, 2026 09:30
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.

1 participant