Skip to content

Instantly share code, notes, and snippets.

@patx
Created August 17, 2025 02:52
Show Gist options
  • Select an option

  • Save patx/c405a5aff0cc03a36aee19a58784406a to your computer and use it in GitHub Desktop.

Select an option

Save patx/c405a5aff0cc03a36aee19a58784406a to your computer and use it in GitHub Desktop.
ai generated test result report

๐Ÿš€ Benchmark: Large File Uploads

MicroPie is built around streaming-first multipart handling, with no heavyweight form parsers.
This design keeps memory usage low and avoids the double-copy overhead seen in other frameworks.

We benchmarked a 13.4 GiB file upload against FastAPI, Litestar, and Starlette on the same machine.

Results

Framework Upload Handler Summary Multipart Parser Elapsed (13.4 GiB) Throughput
MicroPie Streams chunks from ASGI queue straight to disk multipart ~32.6 s ~420 MiB/s
Litestar UploadFile.read() loop multipart ~93.4 s ~147 MiB/s
Starlette await request.form() + file.read() python-multipart ~102 s ~135 MiB/s
FastAPI UploadFile = File(...) + file.read() python-multipart ~101.8 s ~135 MiB/s

Note: Tests were run sequentially, single uvicorn worker, same machine, same filesystem target.
Throughput varies with CPU, disk, and kernel I/O tuning.

Fairness Checklist

  • Verified file size and SHA-256 hash after upload.
  • Same Python version and uvicorn version.
  • Same port, same filesystem target (no tmpfs vs disk mismatch).
  • Disabled indexing/AV processes during runs.
  • Raised request body limits for frameworks that require it.

Why MicroPie Wins

  • MicroPie uses multipart in streaming mode. Incoming chunks are pushed directly into the parser and written to disk as they arrive.
  • Litestar also depends on multipart, but its higher-level abstractions still buffer reads before handing them off.
  • Starlette and FastAPI rely on python-multipart, which parses and buffers the entire request before files are available.

This design difference is why MicroPie shows much higher throughput and lower latency for very large uploads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment