Skip to content

Commit ab6aa7d

Browse files
Improve performance using LTO and disabling asserts
1 parent 4b11a46 commit ab6aa7d

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

generate/templates/templates/binding.gyp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@
77
"macOS_deployment_target": "10.11"
88
},
99

10+
'target_defaults': {
11+
'default_configuration': 'Debug',
12+
'configurations': {
13+
'Debug': {
14+
'defines': [ 'DEBUG', '_DEBUG' ],
15+
},
16+
'Release': {
17+
'defines': [ 'NDEBUG' ],
18+
'cflags': [ '-flto' ],
19+
'xcode_settings': {
20+
'LLVM_LTO': 'YES'
21+
},
22+
'msvs_settings': {
23+
'VCCLCompilerTool': {
24+
'WholeProgramOptimization': 'true'
25+
},
26+
'VCLibrarianTool': {
27+
},
28+
'VCLinkerTool': {
29+
'LinkTimeCodeGeneration': 1
30+
}
31+
}
32+
}
33+
}
34+
},
35+
1036
"targets": [
1137
{
1238
"target_name": "acquireOpenSSL",

vendor/libgit2.gyp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@
1313
"electron_openssl_root%": "<!(node ../utils/getElectronOpenSSLRoot.js <(module_root_dir))",
1414
"electron_openssl_static%": "<!(node -p \"process.platform !== 'linux' || process.env.NODEGIT_OPENSSL_STATIC_LINK === '1' ? 1 : 0\")",
1515
},
16+
'target_defaults': {
17+
'default_configuration': 'Debug',
18+
'configurations': {
19+
'Debug': {
20+
'defines': [ 'DEBUG', '_DEBUG' ],
21+
},
22+
'Release': {
23+
'defines': [ 'NDEBUG' ],
24+
'cflags': [ '-flto' ],
25+
'xcode_settings': {
26+
'LLVM_LTO': 'YES'
27+
},
28+
'msvs_settings': {
29+
'VCCLCompilerTool': {
30+
'WholeProgramOptimization': 'true'
31+
},
32+
'VCLibrarianTool': {
33+
},
34+
'VCLinkerTool': {
35+
'LinkTimeCodeGeneration': 1
36+
}
37+
}
38+
}
39+
}
40+
},
1641
"targets": [
1742
{
1843
"target_name": "libgit2",

0 commit comments

Comments
 (0)