# adlerzz/pocket-benchmark architecture

> Architecture diagram of the GitHub repository adlerzz/pocket-benchmark, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adlerzz/pocket-benchmark
- Repository: https://github.com/adlerzz/pocket-benchmark

## Overview

Bencher is a browser-based benchmark editor: users edit shared setup and teardown scripts plus named test cases, run them, and inspect per-case timings/results and console logs. It also exposes saving benchmark data to a .bjf file; the load control is present but its handler only logs the selected files. The sampled sources establish the main UI and execution path; the app bundle and unsampled editor details are not treated as independent runtime subsystems.

Main entry points: [`fe/src/components/Page.svelte`](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Page.svelte) (Page controller), [`fe/src/components/Main.svelte`](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Main.svelte) (Script and cases), [`fe/src/components/Case.svelte`](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Case.svelte) (Case editor), [`fe/src/services/exec.js`](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/services/exec.js) (Code preparation and execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Benchmark editor"]
  node_page["Page controller<br/>[Page.svelte]"]
  node_main["Script and cases<br/>[Main.svelte]"]
  node_case["Case editor<br/>[Case.svelte]"]
  node_editable["Name editor<br/>[Editable.svelte]"]
  node_codeinput["Code editor<br/>[CodeInput.svelte]"]
  node_side["Console display<br/>[Side.svelte]"]
end

subgraph group_runtime["Benchmark runtime"]
  node_defaults["Default benchmark<br/>[defvalues.js]"]
  node_executor["Code preparation and execution<br/>[exec.js]"]
end

subgraph group_files["Benchmark files"]
  node_saveutil["File serialization<br/>[utils.js]"]
  node_file["Downloaded .bjf file"]
end

node_user(("User"))

node_user -->|"edits and runs"| node_page
node_page -->|"renders"| node_main
node_page -->|"renders logs"| node_side
node_page -->|"initializes from"| node_defaults
node_main -->|"renders cases"| node_case
node_main -->|"renders scripts"| node_codeinput
node_case -->|"renders case code"| node_codeinput
node_case -->|"renders name editor"| node_editable
node_page -->|"executes data"| node_executor
node_executor -->|"reads iteration count"| node_defaults
node_page -->|"saves benchmark"| node_saveutil
node_saveutil -->|"downloads JSON"| node_file

click node_page "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Page.svelte"
click node_main "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Main.svelte"
click node_case "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Case.svelte"
click node_editable "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Editable.svelte"
click node_codeinput "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/CodeInput.svelte"
click node_side "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Side.svelte"
click node_defaults "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/constants/defvalues.js"
click node_executor "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/services/exec.js"
click node_saveutil "https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/services/utils.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_main,node_case,node_editable,node_codeinput,node_side,node_user toneBlue
class node_defaults,node_executor toneAmber
class node_saveutil,node_file toneMint
```

## Components

### Benchmark editor

- [Page controller](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Page.svelte): `fe/src/components/Page.svelte`
- [Script and cases](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Main.svelte): `fe/src/components/Main.svelte`
- [Case editor](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Case.svelte): `fe/src/components/Case.svelte`
- [Name editor](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Editable.svelte): `fe/src/components/Editable.svelte`
- [Code editor](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/CodeInput.svelte): `fe/src/components/CodeInput.svelte`
- [Console display](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/components/Side.svelte): `fe/src/components/Side.svelte`

### Benchmark runtime

- [Default benchmark](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/constants/defvalues.js): `fe/src/constants/defvalues.js`
- [Code preparation and execution](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/services/exec.js): `fe/src/services/exec.js`

### Benchmark files

- [File serialization](https://github.com/adlerzz/pocket-benchmark/blob/main/fe/src/services/utils.js): `fe/src/services/utils.js`
- **Downloaded .bjf file**

### Other components

- **User**

## Connections

- User → Page controller: edits and runs (evidence: `fe/src/components/Page.svelte`)
- Page controller → Script and cases: renders (evidence: `fe/src/components/Page.svelte`)
- Page controller → Console display: renders logs (evidence: `fe/src/components/Page.svelte`)
- Page controller → Default benchmark: initializes from (evidence: `fe/src/components/Page.svelte`)
- Script and cases → Case editor: renders cases (evidence: `fe/src/components/Main.svelte`)
- Script and cases → Code editor: renders scripts (evidence: `fe/src/components/Main.svelte`)
- Case editor → Code editor: renders case code (evidence: `fe/src/components/Case.svelte`)
- Case editor → Name editor: renders name editor (evidence: `fe/src/components/Case.svelte`)
- Page controller → Code preparation and execution: executes data (evidence: `fe/src/components/Page.svelte`)
- Code preparation and execution → Default benchmark: reads iteration count (evidence: `fe/src/services/exec.js`)
- Page controller → File serialization: saves benchmark (evidence: `fe/src/components/Page.svelte`)
- File serialization → Downloaded .bjf file: downloads JSON (evidence: `fe/src/services/utils.js`)
