Skip to content

Instantly share code, notes, and snippets.

View ichard26's full-sized avatar

Richard Si ichard26

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ichard26 on github.
  • I am ichard26 (https://keybase.io/ichard26) on keybase.
  • I have a public key whose fingerprint is 968D A450 8AD2 9495 907A 81D9 8B53 BCCC 2CD0 8DD2

To claim this, I am signing this object:

@ichard26
ichard26 / runner.py
Last active November 5, 2023 00:38
Utility program to compile scripts with mypyc and optionally run them. The generated C and IR can be opened in an editor too. Comes with progress reporting.
#!/usr/bin/env python
import os
import time
import shutil
import socket
import subprocess
import sys
import threading
from contextlib import contextmanager
from pathlib import Path
[21:02:18] Loaded first analysis: /home/ichard26/programming/oss/black/more-consistent-spacing-compiled.json (cached)
Loaded second analysis: /home/ichard26/programming/oss/black/hug-power-op-compiled-4.json (cached)
╭───────────────────────── Summary ──────────────────────────╮
│ 11 projects & 230 files changed / 1586 changes [+793/-793] │
│ │
│ ... out of 2 020 758 lines, 9650 files & 23 projects │
╰────────────────────────────────────────────────────────────╯
[django - https://github.com/django/django.git]
@ichard26
ichard26 / perf-summary.md
Last active February 5, 2022 20:07
Benchmark results from the mypyc integration work for psf/black.

Performance results compiling Black w/ mypyc

Summary

After a lot of work I can confidently say that compiling Black with mypyc will bring excellent performance wins. On average, the time taken to format a file is halved, excluding startup time. Not all files are treated to the same boost though, quite a few files saw even better improvements (up to 2.38x!) and obviously some files didn't see as good improvements.