Remove nodejs cargo profile

The cargo profile in the nodejs folder gets ignored because the crate is in a workspace, but it got me thinking about LTO.

Enabling fat LTO more than doubles the build time, and although it shrinks the binary size, if there is a performance impact it's not very obvious (based on sorting in LOOT with the built DLL). On the other hand, thin LTO only only adds a second to the cargo build time and reduced binary size by ~ 1.4 MB, and adding /LTCG on top reduces it by another ~ 1.6 MB. MSVC doesn't output how long linking takes, but it seemed to only add a second or two.
This commit is contained in:
Oliver Hamlet
2025-04-26 16:40:46 +01:00
parent 0bc73f35fe
commit 4cd9b37471
3 changed files with 3 additions and 6 deletions
+1
View File
@@ -36,6 +36,7 @@ loot-condition-interpreter = "5.3.1"
[profile.release]
debug = "limited"
lto = "thin"
[profile.rel-with-deb-info]
inherits = "release"
+2 -2
View File
@@ -154,7 +154,6 @@ target_include_directories(loot SYSTEM PRIVATE
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(loot PRIVATE UNICODE _UNICODE LOOT_EXPORT)
target_compile_options(loot PRIVATE "/Zc:__cplusplus")
set(LOOT_LIBS ntdll ws2_32 bcrypt)
@@ -167,7 +166,8 @@ endif()
if(MSVC)
# Turn off permissive mode to be more standards-compliant and avoid compiler errors.
target_compile_options(loot PRIVATE "/permissive-" "/W4")
target_compile_options(loot PRIVATE "/permissive-" "/W4" "/Zc:__cplusplus" "/GL")
target_link_options(loot PRIVATE "/LTCG")
endif()
##############################
-4
View File
@@ -16,7 +16,3 @@ napi-derive = "2.12.2"
[build-dependencies]
napi-build = "2.0.1"
[profile.release]
lto = true
strip = "symbols"