# aider-ai/polyglot-benchmark architecture

> Architecture diagram of the GitHub repository aider-ai/polyglot-benchmark, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aider-ai/polyglot-benchmark
- Repository: https://github.com/aider-ai/polyglot-benchmark

## Overview

##### Project Type and Purpose
- This is an open-source, polyglot benchmarking repository. Its goal is to collect a representative set of small exercises from six different language tracks (C++, Go, Java, JavaScript, Python, Rust) and feed them into a separate benchmark harness for performance testing and comparison.

##### Key Components
a. External Inputs
- Exercism Language Track Repositories
(e.g., github.com/exercism/cpp, /go, /java, etc.)
- Aider Blog & Benchmark Harness Documentation (for context)
b. Ingestion Layer
- Sync Scripts or Manual Import
– Copies / updates exercises from each track into this monorepo
- Directory Structure
– Top-level language folders: cpp/, go/, java/, javascript/, python/, rust/
– Inside each: `/exercises/practice/<exercise-name>/` with source, tests, metadata
c. Benchmark Harness (external service or sibling repo)
- Orchestrator
– Detects each exercise folder
– Compiles/runs the code in each language
– Measures execution time, memory, throughput
- Test Runner Plugins
– Language-specific build commands (CMake for C++, go test, gradle, npm, pytest, cargo)
d. Results Aggregator
- Collects raw metrics
- Normalizes data across languages
e. Reporting & Visualization
- Generates charts, tables
- Publishes results on the Aider blog or CI dashboard

##### Relationships & Data Flow
- From Monorepo → Benchmark Harness (pull each language directory)
- Benchmark Harness → Results Aggregator → Reports / CI Dashboard

##### Architectural Patterns & Principles
- Monorepo: co-locates multiple language modules under a common root
- Plugin-based Test Runner: each language track implements a small plugin or script that the harness invokes
- Separation of Concerns: ingestion/update, benchmarking, aggregation, and reporting are distinct stages

##### Detail Level
- Every exercise folder only as one representative module per language (no need to show all 200+ exercises individually)
- Metadata/config directories (.meta, .docs) as standard per-exercise components
- That the benchmark harness is external or sibling code that consumes this repo, rather than embedded here

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Inputs
    ER["Exercism Language Track Repos"]:::external
    BLOG["Aider Blog & Benchmark Docs"]:::external

    %% Ingestion Layer
    SYNC(["Sync Scripts / Manual Import"]):::process

    subgraph "Monorepo (Polyglot Benchmark Repo)"
        ROOT["README.md"]:::repo
        subgraph "Language Tracks"
            subgraph "C++ Track"
                CPP["cpp/"]:::module
                CPP_EX["all-your-base"]:::exercise
            end
            subgraph "Go Track"
                GO["go/"]:::module
                GO_EX["alphametics"]:::exercise
            end
            subgraph "Java Track"
                JAVA["java/"]:::module
                JAVA_EX["all-your-base"]:::exercise
            end
            subgraph "JavaScript Track"
                JS["javascript/"]:::module
                JS_EX["affine-cipher"]:::exercise
            end
            subgraph "Python Track"
                PY["python/"]:::module
                PY_EX["affine-cipher"]:::exercise
            end
            subgraph "Rust Track"
                RS["rust/"]:::module
                RS_EX["accumulate"]:::exercise
            end
        end
    end

    %% Benchmarking, Aggregation, Reporting
    BENCH(["Benchmark Harness"]):::service
    AGG(["Results Aggregator"]):::service
    REP["Reports / CI Dashboard"]:::external

    %% Data Flow
    ER -->|"sync → Monorepo"| SYNC
    SYNC -->|"updates"| ROOT
    ROOT -->|"contains tracks"| CPP
    ROOT --> GO
    ROOT --> JAVA
    ROOT --> JS
    ROOT --> PY
    ROOT --> RS
    CPP -->|"rep exercise"| CPP_EX
    GO --> GO_EX
    JAVA --> JAVA_EX
    JS --> JS_EX
    PY --> PY_EX
    RS --> RS_EX

    CPP -->|"harness pulls"| BENCH
    GO --> BENCH
    JAVA --> BENCH
    JS --> BENCH
    PY --> BENCH
    RS --> BENCH

    BENCH -->|"raw metrics"| AGG
    AGG -->|"reports"| REP

    %% Click Events
    click ROOT "https://github.com/aider-ai/polyglot-benchmark/blob/main/README.md"
    click CPP "https://github.com/aider-ai/polyglot-benchmark/tree/main/cpp/"
    click GO "https://github.com/aider-ai/polyglot-benchmark/tree/main/go/"
    click JAVA "https://github.com/aider-ai/polyglot-benchmark/tree/main/java/"
    click JS "https://github.com/aider-ai/polyglot-benchmark/tree/main/javascript/"
    click PY "https://github.com/aider-ai/polyglot-benchmark/tree/main/python/"
    click RS "https://github.com/aider-ai/polyglot-benchmark/tree/main/rust/"
    click CPP_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/cpp/exercises/practice/all-your-base/"
    click GO_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/go/exercises/practice/alphametics/"
    click JAVA_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/java/exercises/practice/all-your-base/"
    click JS_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/javascript/exercises/practice/affine-cipher/"
    click PY_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/python/exercises/practice/affine-cipher/"
    click RS_EX "https://github.com/aider-ai/polyglot-benchmark/tree/main/rust/exercises/practice/accumulate/"

    %% Styles
    classDef external fill:#cccccc,stroke:#000,stroke-width:1px
    classDef module fill:#add8e6,stroke:#000,stroke-width:1px
    classDef process fill:#fff2cc,stroke:#000,stroke-width:1px
    classDef service fill:#b6d7a8,stroke:#000,stroke-width:1px
    classDef exercise fill:#ffd966,stroke:#000,stroke-width:1px
    classDef repo fill:#f4cccc,stroke:#000,stroke-width:1px
```
