Skip to content

Commit ecf27c3

Browse files
committed
Perf tests
1 parent 4921ffc commit ecf27c3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.evergreen/generated_configs/functions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ functions:
9292
binary: bash
9393
args:
9494
- -c
95-
- "if [ -f .evergreen/scripts/env.sh ]; then . .evergreen/scripts/env.sh; fi; if [ \"Windows_NT\" = \"${OS:-}\" ]; then CARGO_BIN=\"${CARGO_HOME:-$USERPROFILE/.cargo}/bin\"; else CARGO_BIN=\"${CARGO_HOME:-$HOME/.cargo}/bin\"; fi; export PATH=\"$CARGO_BIN:$PATH\"; if ! command -v cargo &> /dev/null; then echo \"Installing Rust...\"; curl --proto \"=https\" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; CARGO_ENV=\"${CARGO_HOME:-$HOME/.cargo}/env\"; if [ -f \"$CARGO_ENV\" ]; then . \"$CARGO_ENV\"; fi; fi; if command -v cargo &> /dev/null && ! command -v maturin &> /dev/null; then echo \"Installing maturin...\"; pip install maturin; fi; echo \"Rust toolchain: $(rustc --version 2>/dev/null || echo not found)\"; echo \"Cargo: $(cargo --version 2>/dev/null || echo not found)\"; echo \"Maturin: $(maturin --version 2>/dev/null || echo not found)\"; if [ -f .evergreen/scripts/env.sh ]; then if ! grep -q \".cargo/bin\" .evergreen/scripts/env.sh; then echo \"# Rust/Cargo PATH\" >> .evergreen/scripts/env.sh; if [ \"Windows_NT\" = \"${OS:-}\" ]; then echo \"export PATH=\\\"\\${CARGO_HOME:-\\$USERPROFILE/.cargo}/bin:\\$PATH\\\"\" >> .evergreen/scripts/env.sh; else echo \"export PATH=\\\"\\${CARGO_HOME:-\\$HOME/.cargo}/bin:\\$PATH\\\"\" >> .evergreen/scripts/env.sh; fi; fi; fi; bash .evergreen/just.sh setup-tests perf rust; export FASTBENCH=1; bash .evergreen/just.sh run-tests test/performance/perf_test.py::TestRustSimpleIntEncodingC test/performance/perf_test.py::TestRustSimpleIntEncodingRust test/performance/perf_test.py::TestRustMixedTypesEncodingC test/performance/perf_test.py::TestRustMixedTypesEncodingRust test/performance/perf_test.py::TestRustSimpleIntDecodingC test/performance/perf_test.py::TestRustSimpleIntDecodingRust test/performance/perf_test.py::TestRustNestedEncodingC test/performance/perf_test.py::TestRustNestedEncodingRust test/performance/perf_test.py::TestRustListEncodingC test/performance/perf_test.py::TestRustListEncodingRust"
95+
- "if [ -f .evergreen/scripts/env.sh ]; then . .evergreen/scripts/env.sh; fi; if [ \"Windows_NT\" = \"${OS:-}\" ]; then CARGO_BIN=\"${CARGO_HOME:-$USERPROFILE/.cargo}/bin\"; else CARGO_BIN=\"${CARGO_HOME:-$HOME/.cargo}/bin\"; fi; export PATH=\"$CARGO_BIN:$PATH\"; if ! command -v cargo &> /dev/null; then echo \"Installing Rust...\"; curl --proto \"=https\" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; CARGO_ENV=\"${CARGO_HOME:-$HOME/.cargo}/env\"; if [ -f \"$CARGO_ENV\" ]; then . \"$CARGO_ENV\"; fi; fi; if command -v cargo &> /dev/null && ! command -v maturin &> /dev/null; then echo \"Installing maturin...\"; pip install maturin; fi; echo \"Rust toolchain: $(rustc --version 2>/dev/null || echo not found)\"; echo \"Cargo: $(cargo --version 2>/dev/null || echo not found)\"; echo \"Maturin: $(maturin --version 2>/dev/null || echo not found)\"; if [ -f .evergreen/scripts/env.sh ]; then if ! grep -q \".cargo/bin\" .evergreen/scripts/env.sh; then echo \"# Rust/Cargo PATH\" >> .evergreen/scripts/env.sh; if [ \"Windows_NT\" = \"${OS:-}\" ]; then echo \"export PATH=\\\"\\${CARGO_HOME:-\\$USERPROFILE/.cargo}/bin:\\$PATH\\\"\" >> .evergreen/scripts/env.sh; else echo \"export PATH=\\\"\\${CARGO_HOME:-\\$HOME/.cargo}/bin:\\$PATH\\\"\" >> .evergreen/scripts/env.sh; fi; fi; fi; bash .evergreen/just.sh setup-tests perf rust; echo \"Building pymongo with Rust extension...\"; uv pip install --reinstall --no-deps --no-build-isolation .; echo \"Verifying Rust extension...\"; python -c \"import bson; print(f'Has Rust: {bson._HAS_RUST}'); print(f'Using Rust: {bson._USE_RUST}'); assert bson._HAS_RUST, 'Rust extension not available!'; assert bson._USE_RUST, 'Rust extension not being used!'; print('Rust extension is active')\"; export FASTBENCH=1; bash .evergreen/just.sh run-tests test/performance/perf_test.py::TestRustSimpleIntEncodingC test/performance/perf_test.py::TestRustSimpleIntEncodingRust test/performance/perf_test.py::TestRustMixedTypesEncodingC test/performance/perf_test.py::TestRustMixedTypesEncodingRust test/performance/perf_test.py::TestRustSimpleIntDecodingC test/performance/perf_test.py::TestRustSimpleIntDecodingRust test/performance/perf_test.py::TestRustNestedEncodingC test/performance/perf_test.py::TestRustNestedEncodingRust test/performance/perf_test.py::TestRustListEncodingC test/performance/perf_test.py::TestRustListEncodingRust"
9696
working_dir: src
9797
include_expansions_in_env:
9898
- PYMONGO_BUILD_RUST

.evergreen/scripts/generate_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,18 @@ def create_perf_rust_func():
14551455
"fi; "
14561456
# Set up the test environment with perf extras
14571457
"bash .evergreen/just.sh setup-tests perf rust; "
1458+
# Build pymongo with Rust extension enabled
1459+
# This reinstalls pymongo with PYMONGO_BUILD_RUST=1 to compile the Rust extension
1460+
'echo "Building pymongo with Rust extension..."; '
1461+
"uv pip install --reinstall --no-deps --no-build-isolation .; "
1462+
# Verify Rust extension is available
1463+
'echo "Verifying Rust extension..."; '
1464+
'python -c "import bson; '
1465+
"print(f'Has Rust: {bson._HAS_RUST}'); "
1466+
"print(f'Using Rust: {bson._USE_RUST}'); "
1467+
"assert bson._HAS_RUST, 'Rust extension not available!'; "
1468+
"assert bson._USE_RUST, 'Rust extension not being used!'; "
1469+
"print('Rust extension is active')\"; "
14581470
# Run the Rust-specific performance benchmarks
14591471
# These tests compare C vs Rust BSON encoding/decoding performance
14601472
# Use pytest node IDs to select specific test classes (avoids quoting issues)

0 commit comments

Comments
 (0)