From 4cda85f01c3f8575a8e7285fa1fc96694003e7ba Mon Sep 17 00:00:00 2001 From: Julian Mesa Date: Fri, 8 Jul 2022 13:15:48 +0200 Subject: [PATCH 1/2] Improve performance using LTO and disabling asserts --- generate/templates/templates/binding.gyp | 26 ++++++++++++++++++++++++ vendor/libgit2.gyp | 25 +++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 26b1f197d..0bb014540 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -7,6 +7,32 @@ "macOS_deployment_target": "10.11" }, + 'target_defaults': { + 'default_configuration': 'Debug', + 'configurations': { + 'Debug': { + 'defines': [ 'DEBUG', '_DEBUG' ], + }, + 'Release': { + 'defines': [ 'NDEBUG' ], + 'cflags': [ '-flto' ], + 'xcode_settings': { + 'LLVM_LTO': 'YES' + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WholeProgramOptimization': 'true' + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'LinkTimeCodeGeneration': 1 + } + } + } + } + }, + "targets": [ { "target_name": "acquireOpenSSL", diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index 4767545bc..f0276796d 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -13,6 +13,31 @@ "electron_openssl_root%": " Date: Wed, 6 Jul 2022 13:19:01 +0200 Subject: [PATCH 2/2] Fix linux tests --- .github/workflows/tests.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ece7ac30e..1d54f4c74 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Install Dependencies for Ubuntu # git >= 2.18 required for actions/checkout git support - run: apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git build-essential clang libssl-dev libkrb5-dev libc++-dev wget + run: apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git build-essential clang-8 lld-8 libssl-dev libkrb5-dev libc++-dev wget env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true @@ -29,6 +29,9 @@ jobs: CC: clang CXX: clang++ run: | + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100 + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100 + update-alternatives --install /usr/bin/ld ld /usr/bin/lld-8 100 mkdir ~/python cd ~/python wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz @@ -65,10 +68,17 @@ jobs: CXX: clang++ npm_config_clang: 1 GYP_DEFINES: use_obsolete_asm=true + AR: "/usr/lib/llvm-8/bin/llvm-ar" + NM: "/usr/lib/llvm-8/bin/llvm-nm" + # ranlib is not needed, and doesn't support .bc files in .a + RANLIB: /bin/true # There is a race condition in node/generate that needs to be fixed # Node 16 changed the logic it uses to select it's UID which means to make node run as root and not 1001, we need to chwon the current directory. More Details: # https://stackoverflow.com/questions/70298238/getting-eaccess-when-running-npm-8-as-root run: | + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100 + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100 + update-alternatives --install /usr/bin/ld ld /usr/bin/lld-8 100 chown root.root -R . npm set unsafe-perm true node utils/retry npm install