Windows: give up stack traces for 40% better performance (#3466)

See: https://github.com/status-im/nimbus-eth2/issues/3453

TODO: make libbacktrace/libunwind work in MSYS2, to get those stack traces back.
This commit is contained in:
Ștefan Talpalaru 2022-03-05 15:40:08 +01:00 committed by GitHub
parent 3795d57d30
commit a130ce1eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 16 deletions

View File

@ -99,6 +99,7 @@ jobs:
base-devel base-devel
git git
mingw-w64-i686-toolchain mingw-w64-i686-toolchain
mingw-w64-i686-cmake
- name: MSYS2 (Windows amd64) - name: MSYS2 (Windows amd64)
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
@ -109,6 +110,7 @@ jobs:
base-devel base-devel
git git
mingw-w64-x86_64-toolchain mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
- name: Restore Nim DLLs dependencies (Windows) from cache - name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -163,6 +165,7 @@ jobs:
fi fi
ncpu="" ncpu=""
make_cmd="make"
case '${{ runner.os }}' in case '${{ runner.os }}' in
'Linux') 'Linux')
ncpu=$(nproc) ncpu=$(nproc)
@ -172,14 +175,16 @@ jobs:
;; ;;
'Windows') 'Windows')
ncpu=${NUMBER_OF_PROCESSORS} ncpu=${NUMBER_OF_PROCESSORS}
make_cmd="mingw32-make"
;; ;;
esac esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
echo "ncpu=${ncpu}" >> $GITHUB_ENV echo "ncpu=${ncpu}" >> $GITHUB_ENV
echo "make_cmd=${make_cmd}" >> $GITHUB_ENV
- name: Build Nim and Nimbus dependencies - name: Build Nim and Nimbus dependencies
run: | run: |
make -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update ${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update
./env.sh nim --version ./env.sh nim --version
- name: Get latest fixtures commit hash - name: Get latest fixtures commit hash
@ -206,17 +211,17 @@ jobs:
- name: Smoke test the Beacon Node and Validator Client with all tracing enabled - name: Smoke test the Beacon Node and Validator Client with all tracing enabled
run: | run: |
make -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} LOG_LEVEL=TRACE nimbus_beacon_node nimbus_validator_client ${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} LOG_LEVEL=TRACE nimbus_beacon_node nimbus_validator_client
- name: Build all tools - name: Build all tools
run: | run: |
make -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }}
# The Windows image runs out of disk space, so make some room # The Windows image runs out of disk space, so make some room
rm -rf nimcache rm -rf nimcache
- name: Run tests - name: Run tests
run: | run: |
make -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} DISABLE_TEST_FIXTURES_SCRIPT=1 test ${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} DISABLE_TEST_FIXTURES_SCRIPT=1 test
# The upload creates a combined report that gets posted as a comment on the PR # The upload creates a combined report that gets posted as a comment on the PR
# https://github.com/EnricoMi/publish-unit-test-result-action # https://github.com/EnricoMi/publish-unit-test-result-action

View File

@ -118,11 +118,6 @@ all: | $(TOOLS) libnfuzz.so libnfuzz.a
# must be included after the default target # must be included after the default target
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk -include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
ifeq ($(OS), Windows_NT)
# libbacktrace/libunwind is disabled on Windows.
USE_LIBBACKTRACE := 0
endif
DEPOSITS_DELAY := 0 DEPOSITS_DELAY := 0
#- "--define:release" cannot be added to "config.nims" #- "--define:release" cannot be added to "config.nims"
@ -131,8 +126,7 @@ DEPOSITS_DELAY := 0
NIM_PARAMS += -d:release --parallelBuild:1 -d:libp2p_agents_metrics -d:KnownLibP2PAgents=nimbus,lighthouse,prysm,teku NIM_PARAMS += -d:release --parallelBuild:1 -d:libp2p_agents_metrics -d:KnownLibP2PAgents=nimbus,lighthouse,prysm,teku
ifeq ($(USE_LIBBACKTRACE), 0) ifeq ($(USE_LIBBACKTRACE), 0)
# Blame Jacek for the lack of line numbers in your stack traces ;-) NIM_PARAMS += -d:disable_libbacktrace
NIM_PARAMS += --stacktrace:on --excessiveStackTrace:on --linetrace:off -d:disable_libbacktrace
endif endif
deps: | deps-common nat-libs build/generate_makefile deps: | deps-common nat-libs build/generate_makefile

View File

@ -130,10 +130,7 @@ switch("define", "withoutPCRE")
switch("import", "testutils/moduletests") switch("import", "testutils/moduletests")
const useLibStackTrace = not defined(windows) and when not defined(disable_libbacktrace):
not defined(disable_libbacktrace)
when useLibStackTrace:
--define:nimStackTraceOverride --define:nimStackTraceOverride
switch("import", "libbacktrace") switch("import", "libbacktrace")
else: else:

View File

@ -53,6 +53,9 @@ if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
# undefined symbols, so we're forced to use g++ as a linker wrapper. # undefined symbols, so we're forced to use g++ as a linker wrapper.
# For some reason, macOS's Clang doesn't need this trick, nor do native (and # For some reason, macOS's Clang doesn't need this trick, nor do native (and
# newer) Mingw-w64 toolchains on Windows. # newer) Mingw-w64 toolchains on Windows.
#
# nim-blscurve's Windows SSSE3 detection doesn't work when cross-compiling,
# so we enable it here.
make \ make \
-j$(nproc) \ -j$(nproc) \
CC="${CC}" \ CC="${CC}" \
@ -60,7 +63,7 @@ if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
CXXFLAGS="${CXXFLAGS} -D__STDC_FORMAT_MACROS -D_WIN32_WINNT=0x0600" \ CXXFLAGS="${CXXFLAGS} -D__STDC_FORMAT_MACROS -D_WIN32_WINNT=0x0600" \
USE_VENDORED_LIBUNWIND=1 \ USE_VENDORED_LIBUNWIND=1 \
LOG_LEVEL="TRACE" \ LOG_LEVEL="TRACE" \
NIMFLAGS="${NIMFLAGS_COMMON} --os:windows --gcc.exe=${CC} --gcc.linkerexe=${CXX} --passL:-static" \ NIMFLAGS="${NIMFLAGS_COMMON} --os:windows --gcc.exe=${CC} --gcc.linkerexe=${CXX} --passL:-static -d:BLSTuseSSSE3=1" \
${BINARIES} ${BINARIES}
elif [[ "${PLATFORM}" == "Linux_arm32v7" ]]; then elif [[ "${PLATFORM}" == "Linux_arm32v7" ]]; then
CC="arm-linux-gnueabihf-gcc" CC="arm-linux-gnueabihf-gcc"