[QGIS-Developer] SIP is insane

Alessandro Pasotti apasotti at gmail.com
Sat Jun 6 09:40:27 PDT 2026


Hi Even,

I hear your scream and I scream with you :)

Something has definitely worsened after the shift to QT6  (even if I'm
not sure if the QT version has anything to do).

I've come to the point where I cannot build QGIS on my laptop (16GB
RAM 4 physical cores) anymore and even on my office PC (32 GB RAM and
8 physical cores) it occasionally crashes for OOM or freezes.

All the times that it happened, sip-build was eating up all resources.

I am sorry this is just a "me too" and I have no solution for this issue.


On Sat, Jun 6, 2026 at 3:16 AM Even Rouault via QGIS-Developer
<qgis-developer at lists.osgeo.org> wrote:
>
> Hi,
>
> sorry for the  eye-catching email title, couldn't resist.
>
> Am I the only QGIS dev highly frustrated by the bottleneck of sip-build
> when building QGIS? Can we do something (funding upstream?) to improve that?
>
> Also some mind bogging stats:
>
> - size of all QGIS headers: find ../src -name "*.h" -exec cat {} \;  |
> wc -l :  570 288
> - size of QGIS .cpp + .ui: find ../src \( -name "*.cpp" -o -name "*.ui"
> \) -exec cat {} \;  | wc -l : 1 497 216
>
> So QGIS is just a 2 million LoC (excluding tests) code base
>
> - size of .sip generated files: find . -name "*.sip" -exec cat {} \; |
> wc -l : 335 425
> - size of SIP generated .cpp files:   find python/ -name "*.cpp" -exec
> cat {} \;  | wc -l:  7 532 645  .  7.5 millions LoC !!!
> - size of MOC generated .cpp files: find src/ -name "*.cpp" -exec cat {}
> \;  | wc -l :  2 051 769
>
> So 2 observations:
>
> - we bind to Python a very large part of our header files (more than
> half). I've always found that the amount of things exposed to Python was
> excessive. IMHO we should be much more conservative, and wait for plugin
> authors to ask for an API to be exposed, rather than expose it prematurely.
>
> - SIP generates > 20 times more lines of .cpp than .sip files!!!  Or
> 3.75 times more lines of code than QGIS actual logic.
>
> That shows in (stripped) .so files:
>
> -  output/python/qgis/*.so : 130 MB
> - output/lib/*.so.4.1.0 : 170 MB.
>
> So not as crazy as the 7.5 vs 2 MLOC of ratio, but still.
>
> Comparison with GDAL and SWIG:
> - size of public .h headers: 50 162 .
> - size of Python SWIG source .i files:  ~43 000  (hard to count exactly
> as there's some bits of Java and C# in this count)
> - size of SWIG Python generated .cpp files: 164 151 .
> So a 4x only ratio of .cpp vs .i
>
> I don't recommend SWIG, but something looks fishy in the kingdom of SIP
>
> Even
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list