python-to-rust-cpp / README.md
YugJ's picture
Upload README.md with huggingface_hub
149a666 verified
|
Raw History Blame Contribute Delete
1.58 kB

A newer version of the Gradio SDK is available: 6.30.0

Upgrade
metadata
title: Python → Rust & C++
emoji: ⚡
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 6.23.1
app_file: app.py
pinned: false
short_description: LLM ports Python to Rust or C++, measured and verified

Python → Rust & C++

Give it a Python program. An LLM rewrites it in Rust or C++. Both are then compiled and executed under the same sandbox, so the speedup is measured, not estimated — and the two outputs are compared, because a translation that is fast but wrong is not a translation.

Measured results

Max subarray sum, O(n²), n=10 000 × 20 seeds, measured on a laptop:

Target Model Python Compiled Speedup Output
C++ GPT-5 Nano 24.739 s 0.337 s 73× identical ✓
Rust GPT-5 24.518 s 0.391 s 63× identical ✓
Rust GPT-5 Nano 24.590 s 0.405 s 61× identical ✓

Timings on this Space will be slower — it runs on shared CPU. The ratio is the point and stays representative.

Notes

  • Free to use. The demo runs on a free-tier model. Frontier models (GPT-5, Claude, Grok) require your own API key — pasted keys are used for a single request and never logged, stored, or written to disk.
  • Submitted code is sandboxed. It runs in a separate process with an allowlisted environment containing no API keys, a wall-clock timeout, and CPU, memory, and process-count limits.
  • First load may take ~30 seconds if the Space has been idle.

Source and full write-up: https://github.com/Yugjohri/python-to-rust-cpp