Skip to content

Commit 6d591fa

Browse files
authored
Merge pull request #689 from RooVetGit/cte/benchmarks
Aider-inspired polyglot benchmarks
2 parents 8569c46 + e2bdce0 commit 6d591fa

27 files changed

+3266
-53
lines changed

.changeset/little-parents-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Aider-inspired polyglot benchmarks

.dockerignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Version control
2+
# .git/
3+
# .gitignore
4+
# .gitattributes
5+
# .git-blame-ignore-revs
6+
# .gitconfig
7+
8+
# Build artifacts
9+
bin/
10+
dist/
11+
**/dist/
12+
out/
13+
**/out/
14+
15+
# Dependencies
16+
node_modules/
17+
**/node_modules/
18+
19+
# Test and development files
20+
coverage/
21+
**/.vscode-test/
22+
23+
# Configuration files
24+
# .env*
25+
knip.json
26+
.husky/
27+
28+
# CI/CD
29+
# .changeset/
30+
# .github/
31+
# ellipsis.yaml
32+
33+
# OS specific
34+
.DS_Store
35+
36+
# Logs
37+
logs/
38+
*.log
39+
40+
# Nix
41+
# flake.lock
42+
# flake.nix
43+
44+
# Monorepo
45+
benchmark/exercises/

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.vscode-test/**
66
out/**
77
out-integration/**
8+
benchmark/**
89
e2e/**
910
node_modules/**
1011
src/**

benchmark/.env.local.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OPENROUTER_API_KEY=sk-or-v1-...
2+
POSTHOG_API_KEY=phc_...

benchmark/Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# docker build -f Dockerfile.base -t roo-code-benchmark-base ..
2+
# docker build -f Dockerfile -t roo-code-benchmark ..
3+
# docker run -d -it -p 3000:3000 -v /tmp/benchmarks.db:/tmp/benchmarks.db roo-code-benchmark
4+
# docker exec -it $(docker ps --filter "ancestor=roo-code-benchmark" -q) /bin/bash
5+
6+
FROM ubuntu:latest
7+
8+
# Install dependencies
9+
RUN apt update && apt install -y sudo curl git vim jq
10+
11+
# Create a `vscode` user
12+
RUN useradd -m vscode -s /bin/bash && \
13+
echo "vscode ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vscode && \
14+
chmod 0440 /etc/sudoers.d/vscode
15+
16+
# Install VS Code
17+
# https://code.visualstudio.com/docs/setup/linux
18+
RUN apt install -y wget gpg apt-transport-https
19+
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
20+
RUN install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
21+
RUN echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | tee /etc/apt/sources.list.d/vscode.list > /dev/null
22+
RUN rm -f packages.microsoft.gpg
23+
RUN apt update && apt install -y code
24+
25+
# Install Xvfb
26+
RUN apt install -y xvfb
27+
28+
# [cpp] Install cmake 3.28.3
29+
RUN apt install -y cmake
30+
31+
# [go] Install Go 1.22.2
32+
RUN apt install -y golang-go
33+
34+
# [java] Install Java 21
35+
RUN apt install -y default-jre
36+
37+
# [javascript] Install Node.js v18.20.6
38+
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
39+
RUN apt update && apt install -y nodejs
40+
RUN npm install -g corepack@latest
41+
42+
# [python] Install Python 3.12.3 and uv 0.6.6
43+
RUN apt install -y python3 python3-venv python3-dev python3-pip
44+
45+
# [rust] Install Rust 1.85
46+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
47+
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
48+
49+
WORKDIR /home/vscode
50+
USER vscode
51+
52+
# Enable corepack and install pnpm for the vscode user
53+
RUN corepack enable
54+
RUN yes y | pnpm --version
55+
56+
COPY benchmark/entrypoint.sh /usr/local/bin/entrypoint.sh
57+
58+
# Copy and build dependencies
59+
COPY --chown=vscode:vscode package*.json /home/vscode/repo/
60+
COPY --chown=vscode:vscode webview-ui/package*.json /home/vscode/repo/webview-ui/
61+
COPY --chown=vscode:vscode e2e/package*.json /home/vscode/repo/e2e/
62+
COPY --chown=vscode:vscode benchmark/package*.json /home/vscode/repo/benchmark/
63+
WORKDIR /home/vscode/repo
64+
RUN npm run install:all
65+
66+
# Copy and build benchmark runner
67+
COPY --chown=vscode:vscode . /home/vscode/repo
68+
WORKDIR /home/vscode/repo/benchmark
69+
RUN npm run build
70+
71+
# Copy exercises
72+
WORKDIR /home/vscode
73+
RUN git clone https://github.com/cte/Roo-Code-Benchmark.git exercises
74+
75+
# Prepare exercises
76+
WORKDIR /home/vscode/exercises/python
77+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
78+
RUN /home/vscode/.local/bin/uv sync
79+
80+
# Build web-ui
81+
WORKDIR /home/vscode/exercises/web-ui
82+
RUN echo "DB_FILE_NAME=file:/tmp/benchmarks.db" > .env
83+
RUN pnpm install
84+
RUN npx drizzle-kit push
85+
86+
# Run web-ui
87+
EXPOSE 3000
88+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
89+
CMD ["/usr/bin/pnpm", "dev"]

benchmark/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Benchmark Harness
2+
3+
Configure ENV vars (OpenRouter, PostHog, etc):
4+
5+
```sh
6+
cp .env.local.sample .env.local
7+
# Update ENV vars as needed.
8+
```
9+
10+
Build and run a Docker image with the development environment needed to run the
11+
benchmarks (C++, Go, Java, Node.js, Python & Rust):
12+
13+
```sh
14+
npm run docker:start
15+
```
16+
17+
Run an exercise:
18+
19+
```sh
20+
npm run docker:benchmark -- -e exercises/javascript/binary
21+
```
22+
23+
Select and run an exercise:
24+
25+
```sh
26+
npm run cli
27+
```
28+
29+
Select and run an exercise for a specific language:
30+
31+
```sh
32+
npm run cli -- run rust
33+
```
34+
35+
Run all exercises for a language:
36+
37+
```sh
38+
npm run cli -- run rust all
39+
```
40+
41+
Run all exercises:
42+
43+
```sh
44+
npm run cli -- run all
45+
```
46+
47+
Run all exercises using a specific runId (useful for re-trying when an unexpected error occurs):
48+
49+
```sh
50+
npm run cli -- run all --runId 1
51+
```

benchmark/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
npx drizzle-kit push
4+
exec "$@"

0 commit comments

Comments
 (0)