diff --git a/playground/benchmarks.html b/playground/benchmarks.html index 9136a17b..9dc60762 100644 --- a/playground/benchmarks.html +++ b/playground/benchmarks.html @@ -23,13 +23,13 @@ font-family: system-ui, -apple-system, sans-serif; line-height: 1.6; padding: 2rem; - max-width: 900px; + max-width: 960px; margin: 0 auto; } a { color: var(--accent); } h1 { color: var(--accent); margin-bottom: 0.5rem; } - h2 { margin-top: 0; margin-bottom: 0.5rem; font-size: 1.25rem; } - p { color: #8b949e; margin-bottom: 1rem; } + h2 { margin-top: 2rem; margin-bottom: 0.5rem; font-size: 1.25rem; } + p, .desc { color: #8b949e; margin-bottom: 1rem; } code { font-family: var(--font-mono); font-size: 0.875em; @@ -39,141 +39,145 @@ padding: 0.1rem 0.4rem; } .back { margin-bottom: 2rem; display: inline-block; } - .subtitle { margin-bottom: 1.5rem; } - - #playground-loading { - position: fixed; inset: 0; - background: rgba(13, 17, 23, 0.92); - display: flex; flex-direction: column; - align-items: center; justify-content: center; - z-index: 1000; gap: 1rem; - } - .spinner { - width: 40px; height: 40px; - border: 3px solid var(--border); - border-top-color: var(--accent); - border-radius: 50%; - animation: spin 0.8s linear infinite; - } - @keyframes spin { to { transform: rotate(360deg); } } - #playground-status { color: #8b949e; font-size: 0.95rem; } - - .section { - background: var(--surface); - border: 1px solid var(--border); - border-radius: 0.75rem; - padding: 1.5rem; - margin-bottom: 1.5rem; - } - .section p { margin-bottom: 0.75rem; } - .playground-block { margin-top: 0.75rem; } - .playground-header { - display: flex; align-items: center; justify-content: space-between; - background: #1c2128; + /* Benchmark table */ + .bench-table { + width: 100%; + border-collapse: collapse; + margin-top: 1rem; + margin-bottom: 2rem; + } + .bench-table th, .bench-table td { + text-align: left; + padding: 0.75rem 1rem; border: 1px solid var(--border); - border-bottom: none; - border-radius: 0.5rem 0.5rem 0 0; - padding: 0.4rem 0.75rem; } - .playground-label { - font-size: 0.75rem; color: #8b949e; - text-transform: uppercase; letter-spacing: 0.05em; + .bench-table th { + background: var(--surface); + color: var(--accent); + font-weight: 600; + font-size: 0.9rem; } - .playground-actions { display: flex; gap: 0.5rem; } - .playground-actions button { - background: transparent; color: var(--accent); - border: 1px solid var(--border); - border-radius: 0.35rem; - padding: 0.25rem 0.7rem; - font-size: 0.8rem; cursor: pointer; - font-family: system-ui, sans-serif; - transition: background 0.15s, border-color 0.15s; - } - .playground-actions button:hover:not(:disabled) { - background: rgba(88, 166, 255, 0.1); - border-color: var(--accent); - } - .playground-actions button:disabled { opacity: 0.4; cursor: not-allowed; } - .playground-run { font-weight: 600; } - - .playground-editor { - display: block; width: 100%; min-height: 80px; - background: #0d1117; color: var(--text); - border: 1px solid var(--border); - border-top: none; border-bottom: none; - padding: 1rem; + .bench-table td { font-family: var(--font-mono); - font-size: 0.875rem; line-height: 1.55; - resize: vertical; outline: none; - tab-size: 2; white-space: pre; overflow-x: auto; + font-size: 0.875rem; } - .playground-editor:focus { - border-color: var(--accent); - box-shadow: inset 0 0 0 1px var(--accent); + .bench-table tr:nth-child(even) { + background: rgba(22, 27, 34, 0.5); } + .faster-tsb { color: var(--green); font-weight: 600; } + .faster-pandas { color: var(--orange); font-weight: 600; } + .ratio-badge { + display: inline-block; + padding: 0.15rem 0.5rem; + border-radius: 0.3rem; + font-size: 0.8rem; + font-weight: 600; + } + .ratio-badge.fast { background: rgba(63, 185, 80, 0.15); color: var(--green); } + .ratio-badge.slow { background: rgba(210, 153, 34, 0.15); color: var(--orange); } - .playground-output { - background: #1c2333; + .info-box { + background: var(--surface); border: 1px solid var(--border); - border-radius: 0 0 0.5rem 0.5rem; - padding: 0.75rem 1rem; - font-family: var(--font-mono); - font-size: 0.85rem; color: #8b949e; - white-space: pre-wrap; min-height: 2rem; - word-break: break-word; + border-radius: 0.75rem; + padding: 1.25rem; + margin: 1.5rem 0; + } + .info-box h3 { + color: var(--accent); + margin-bottom: 0.5rem; + font-size: 1rem; + } + .info-box p, .info-box li { + color: #8b949e; + font-size: 0.875rem; + } + .info-box ul { + margin-left: 1.25rem; + margin-top: 0.5rem; } - .playground-output.active { color: var(--green); border-color: var(--green); } - .playground-output.error { color: var(--red); border-color: var(--red); } - .playground-hint { - font-size: 0.75rem; color: #484f58; - margin-top: 0.35rem; text-align: right; + .info-box li { margin-bottom: 0.25rem; } + + .timestamp { + color: #484f58; + font-size: 0.8rem; + margin-top: 1rem; } footer { text-align: center; - padding: 2rem 0; + padding: 2rem; color: #8b949e; font-size: 0.85rem; border-top: 1px solid var(--border); - margin-top: 2rem; + margin-top: 3rem; + } + + #no-data { + text-align: center; + padding: 3rem; + color: #8b949e; } + #no-data p { color: #8b949e; font-size: 1rem; } + ← back to index +

⚡ Performance Benchmarks

+

+ Side-by-side performance comparison of tsb (TypeScript/Bun) vs + pandas (Python). Each function is benchmarked with identical datasets + and the same number of iterations. +

-
-
-
Initializing playground…
+ - ← Back to roadmap -

Performance Benchmarks: tsb vs pandas

-

Side-by-side performance comparison of tsb (TypeScript/Bun) vs - pandas (Python). Each function is benchmarked with identical datasets - and the same number of iterations.

- -
-

Try it

-

Edit and press ▶ Run to execute. Use the imports listed below as a starting point.

-
-
- TypeScript -
- - -
-
- -
Click ▶ Run to execute
-
Ctrl+Enter to run · Tab to indent
-
+ + + + + + + + + + + + + + + + + +
+

📐 Methodology

+

Each benchmark follows a consistent protocol:

+
    +
  • Dataset: 100,000 elements, deterministic generation
  • +
  • Warm-up: 5 untimed iterations
  • +
  • Measured: 50 timed iterations, mean reported
  • +
  • tsb runtime: Bun (latest)
  • +
  • pandas runtime: CPython + pandas (latest)
  • +
  • Ratio: tsb_time / pandas_time — below 1.0 means tsb is faster
  • +
+
+ +
+

🤖 About

+

+ These benchmarks are generated automatically by the Autoloop + perf-comparison program. Each iteration adds a new function + comparison. Results are updated on every accepted iteration and deployed + to this page. +

@@ -183,6 +187,66 @@

Try it

- + diff --git a/tests/playground.test.ts b/tests/playground.test.ts index dba87fa0..10493600 100644 --- a/tests/playground.test.ts +++ b/tests/playground.test.ts @@ -26,6 +26,8 @@ const PLAYGROUND_DIR = join(import.meta.dir, "..", "playground"); const NON_PLAYGROUND_PAGES = new Set([ // The landing page is a roadmap/index — no executable code blocks. "index.html", + // The benchmarks page is a results chart (tsb vs pandas), not a playground. + "benchmarks.html", ]); function listPlaygroundHtmlFiles(): string[] {