Skip to content

Overly large binary size

The resulting binary seems much larger than it needs to be, mostly due to variadic templates AFAICS.

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  65.1%  2.37Mi  63.3%  1.99Mi    [2029 Others]
   4.7%   174Ki   5.4%   173Ki    medialibrary::sqlite::errors::mapToException()
   3.8%   143Ki   4.4%   143Ki    [section .gcc_except_table]
   3.3%   121Ki   3.4%   110Ki    medialibrary::sqlite::Tools::fetchAll<>()
   2.7%   100Ki   3.0%  95.6Ki    medialibrary::SqliteQuery<>::all()
   2.4%  88.5Ki   2.6%  83.0Ki    medialibrary::SqliteQuery<>::items()
   1.9%  72.0Ki   2.1%  66.6Ki    medialibrary::SqliteQuery<>::count()
   1.9%  70.0Ki   2.0%  63.8Ki    medialibrary::Log::createMsg<>()
   1.5%  56.8Ki   1.5%  48.7Ki    std::vector<>::_M_realloc_insert<>()
   1.5%  55.4Ki   1.6%  51.8Ki    medialibrary::sqlite::Tools::executeInsert<>()
   1.4%  54.0Ki   1.3%  43.2Ki    medialibrary::make_query<>()
   1.4%  51.8Ki   1.1%  36.0Ki    medialibrary::SqliteQuery<>::~SqliteQuery()
   1.3%  49.3Ki   1.0%  33.6Ki    medialibrary::SqliteQuery<>
   1.0%  38.0Ki   0.8%  24.6Ki    medialibrary::SqliteQueryBase<>
   1.0%  36.6Ki   1.0%  33.7Ki    medialibrary::SqliteQueryBase<>::executeCount()
   1.0%  35.6Ki   1.0%  32.9Ki    medialibrary::sqlite::Tools::executeDelete<>()
   0.9%  35.2Ki   1.0%  32.5Ki    medialibrary::sqlite::Tools::fetchOne<>()
   0.9%  34.5Ki   1.1%  34.4Ki    _GLOBAL__sub_I_Logger.cpp
   0.9%  32.0Ki   1.0%  31.9Ki    _ZN12medialibrary10MediaGroup7triggerB5cxx11ENS0_8TriggersEj
   0.7%  27.4Ki   0.6%  18.3Ki    std::_Sp_counted_ptr_inplace<>
   0.6%  22.8Ki   0.7%  22.8Ki    [section .plt]
 100.0%  3.64Mi 100.0%  3.14Mi    TOTAL

One easy lead would be to refactor the logging functions to be used like std::ostream, a quick test disabling logging entirely shows a ≃500KB reduction in the binary size (≃15%)

Removing variadic templates for sqlite interactions would cause a major rewrite of the sqlite wrappers though I'm afraid :/

Edited by Hugo Beauzée-Luyssen
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information