fold/bench/corpora/rust-oss/fetch.sh
trvon a36801cf8e
perf: Z3 LRU cache, batch observers, fold-rust body cache, ripgrep benchmark
- Z3 query LRU cache (4096 entries, O(1) promote/evict)
- Batch observer dispatch in security walker
- fold-rust: single-walk hash, dead code removed, timing added
- bench/corpora/rust-oss/: ripgrep benchmark harness
2026-05-27 19:06:32 -04:00

39 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Fetch a well-known Rust OSS codebase for the fold Rust-mode benchmark.
# Defaults to ripgrep (~52k LOC Rust, ~100 .rs files across a Cargo workspace).
#
# Layout afterwards:
# bench/corpora/rust-oss/ripgrep/
# Cargo.toml
# crates/
# ...
#
# Set RUST_OSS_REPO and RUST_OSS_REF to override the target.
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
REPO="${RUST_OSS_REPO:-https://github.com/BurntSushi/ripgrep.git}"
REF="${RUST_OSS_REF:-master}"
NAME="ripgrep"
cd "$HERE"
if [[ -d "$NAME/.git" ]]; then
echo "rust-oss: $NAME already cloned at $HERE/$NAME; skipping."
exit 0
fi
echo "Cloning $REPO (ref=$REF, depth=1)..."
git clone --depth 1 --filter=blob:none --branch "$REF" "$REPO" "$NAME"
RUST_COUNT=$(find "$NAME" -name '*.rs' | wc -l | tr -d ' ')
LOC=$(find "$NAME" -name '*.rs' -exec cat {} + | wc -l | tr -d ' ')
echo "rust-oss: $NAME ready — $RUST_COUNT .rs files, $LOC lines"
# Pre-fetch dependencies so cargo check inside fold-rust doesn't stall.
echo "rust-oss: fetching cargo dependencies..."
( cd "$NAME" && cargo fetch 2>&1 | tail -3 ) || true
echo ""
echo "Next:"
echo " python3 bench/run_rust_oss.py"
echo " python3 bench/run_rust_oss.py --corpus $HERE/$NAME"