libvips / build-win64-mxe

79 stars 15 forks source link

Possible improvement: use default optimisation level of -Os, selectively compile at -O3 #55

Closed lovell closed 1 year ago

lovell commented 1 year ago

At the moment we optimise C/C++ dependencies for performance via -O3:

https://github.com/libvips/build-win64-mxe/blob/41e8e1c1cdef5e6e1e50e69b62cd7c1378cff82a/build/settings/llvm-release.mk#L11-L12

...and Rust dependencies (librsvg for now, others will surely follow) for size via z:

https://github.com/libvips/build-win64-mxe/blob/41e8e1c1cdef5e6e1e50e69b62cd7c1378cff82a/build/settings/llvm-release.mk#L20

As the worst case example, aom is particularly huge and doesn't really benefit from -O3 as an increasing number of its hot functions/loops are written in assembler.

Should we switch to optimise C/C++ at -Os by default then selectively opt-in certain dependencies to -O3 where we know that is the better option, similar to the approach taken by the sharp-libvips scripts?

kleisauke commented 1 year ago

Good idea, I'm currently doing a test build with commit fe13fb21fc3c31450f8b7ea20c9d8ba1259253e2.

As an aside, you might also be interested in commit 84ea6be330a5a1af8056cc206cd71e7080b92d21, which links libglib-2.0-0.dll and libgobject-2.0-0.dll statically in libvips-42.dll.