Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion barretenberg/cpp/scripts/run_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ filter=$4
export GTEST_COLOR=1
export HARDWARE_CONCURRENCY=${CPUS:-8}

# Set ALLOCATOR=tcmalloc to use tcmalloc via LD_PRELOAD.
BENCH_PRELOAD=""
if [ "${ALLOCATOR:-}" = "tcmalloc" ]; then
sudo apt-get update -qq && sudo apt-get install -y -qq libtcmalloc-minimal4t64
BENCH_PRELOAD="/usr/lib/$(uname -m)-linux-gnu/libtcmalloc_minimal.so.4"
fi

mkdir -p bench-out/$(dirname $name)

export MEMUSAGE_OUT="bench-out/$name-peak-memory-mb.txt"

case $arch in
native)
memusage $bin --benchmark_out=./bench-out/$name.json --benchmark_filter=$filter
LD_PRELOAD="${BENCH_PRELOAD}" memusage $bin --benchmark_out=./bench-out/$name.json --benchmark_filter=$filter
;;
wasm)
memusage ./scripts/wasmtime.sh $bin --benchmark_out=./bench-out/$name.json --benchmark_filter=$filter
Expand Down
5 changes: 4 additions & 1 deletion release-image/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN apt update && apt install -y \
netcat-openbsd \
parallel \
curl \
gnupg && \
gnupg \
libtcmalloc-minimal4t64 && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt update && apt install nodejs && \
Expand All @@ -33,6 +34,8 @@ COPY --from=build /opt/foundry/bin/anvil /opt/foundry/bin/anvil
COPY --from=build /opt/foundry/bin/forge /opt/foundry/bin/forge
COPY --from=build /opt/foundry/bin/cast /opt/foundry/bin/cast
ENV PATH="/opt/foundry/bin:$PATH" FOUNDRY_DISABLE_NIGHTLY_WARNING="1"
# Use tcmalloc for reduced memory fragmentation and improved allocation performance.
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"
# Copy in production dependencies.
COPY --from=build /usr/src/yarn-project/node_modules /usr/src/yarn-project/node_modules
# We install a symlink to yarn-project's node_modules at a location that all portalled packages can find as they
Expand Down
Loading