Skip to content

Commit

Permalink
Print floretta.wasm.gz size too
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep committed Nov 20, 2024
1 parent c5776aa commit ee8bbb2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/summary.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
#!/usr/bin/env python3

import gzip
from pathlib import Path


def main():
size = Path("floretta.wasm").stat().st_size
print(f"`floretta.wasm` is {size} bytes.")
def print_sizes(files: dict[str, int]) -> None:
m = max(len(k) for k in files.keys())
n = max(len(str(v)) for v in files.values())
print("```")
for k, v in files.items():
print(f"{k:<{m}} is {v:>{n}} bytes")
print("```")


def main() -> None:
name = "floretta.wasm"
wasm = Path(name).read_bytes()
gz = gzip.compress(wasm)
print_sizes({name: len(wasm), f"{name}.gz": len(gz)})


if __name__ == "__main__":
Expand Down

0 comments on commit ee8bbb2

Please sign in to comment.