Skip to content

Commit 2a68aa0

Browse files
committed
Update size calculation to take in account brotli packages
1 parent 20c3eb9 commit 2a68aa0

2 files changed

Lines changed: 37 additions & 26 deletions

File tree

dist/BUNDLE_SIZES.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
Generated by `tools/release_bundle_sizes.py`. Use this table in RELEASE_*.md or docs/FEATURES_AND_BUNDLE.md.
44

5-
| Target | Subtarget | Size | Bytes | Path |
6-
|--------|-----------|------|-------|------|
7-
| CNC | GRBL | 91.2 KB | 93368 | CNC\GRBL\index.html.gz; CNC\GRBL\index.html.br |
8-
| CNC | GRBLHal | 95.8 KB | 98112 | CNC\GRBLHal\index.html.gz; CNC\GRBLHal\index.html.br |
9-
| Printer3D | Marlin | 97.1 KB | 99480 | Printer3D\Marlin\index.html.gz; Printer3D\Marlin\index.html.br |
10-
| Printer3D | Marlin-embedded | 96.6 KB | 98879 | Printer3D\Marlin-embedded\index.html.gz; Printer3D\Marlin-embedded\index.html.br |
11-
| Printer3D | Repetier | 96.0 KB | 98253 | Printer3D\Repetier\index.html.gz; Printer3D\Repetier\index.html.br |
12-
| Printer3D | Smoothieware | 95.6 KB | 97875 | Printer3D\Smoothieware\index.html.gz; Printer3D\Smoothieware\index.html.br |
13-
| SandTable | GRBL | 83.4 KB | 85399 | SandTable\GRBL\index.html.gz; SandTable\GRBL\index.html.br |
5+
| Target | Subtarget | Gzip Path | Gzip Size | Brotli Path | Brotli Size |
6+
|--------|-----------|-----------|-----------|-------------|-------------|
7+
| CNC | GRBL | CNC\GRBL\index.html.gz | 91.2 KB | CNC\GRBL\index.html.br | 75.6 KB |
8+
| CNC | GRBLHal | CNC\GRBLHal\index.html.gz | 95.8 KB | CNC\GRBLHal\index.html.br | 79.0 KB |
9+
| Printer3D | Marlin | Printer3D\Marlin\index.html.gz | 97.1 KB | Printer3D\Marlin\index.html.br | 80.2 KB |
10+
| Printer3D | Marlin-embedded | Printer3D\Marlin-embedded\index.html.gz | 96.6 KB | Printer3D\Marlin-embedded\index.html.br | 79.8 KB |
11+
| Printer3D | Repetier | Printer3D\Repetier\index.html.gz | 96.0 KB | Printer3D\Repetier\index.html.br | 79.3 KB |
12+
| Printer3D | Smoothieware | Printer3D\Smoothieware\index.html.gz | 95.6 KB | Printer3D\Smoothieware\index.html.br | 78.8 KB |
13+
| SandTable | GRBL | SandTable\GRBL\index.html.gz | 83.4 KB | SandTable\GRBL\index.html.br | 69.1 KB |
1414

15-
**Total size (all packages):** 1.17 MB (1226172 bytes).
15+
**Total Gzip size:** 655.6 KB (671366 bytes).
16+
**Total Brotli size:** 541.8 KB (554806 bytes).

tools/release_bundle_sizes.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
ESP3D-WEBUI release bundle sizes report.
44
55
1. Runs `npm run buildall` (builds all targets/subtargets).
6-
2. Scans dist/ for index.html.gz (and any other artifacts) and collects sizes.
7-
3. Writes a Markdown document with a table: target, subtarget, size (bytes + human), path.
6+
2. Scans dist/ for index.html.gz, index.html.br (and any other artifacts) and collects sizes.
7+
3. Writes a Markdown document with a table: target, subtarget, gzip path/size, brotli path/size.
88
99
Usage:
1010
python tools/release_bundle_sizes.py
@@ -108,26 +108,36 @@ def main() -> int:
108108
"",
109109
"Generated by `tools/release_bundle_sizes.py`. Use this table in RELEASE_*.md or docs/FEATURES_AND_BUNDLE.md.",
110110
"",
111-
"| Target | Subtarget | Size | Bytes | Path |",
112-
"|--------|-----------|------|-------|------|",
111+
"| Target | Subtarget | Gzip Path | Gzip Size | Brotli Path | Brotli Size |",
112+
"|--------|-----------|-----------|-----------|-------------|-------------|",
113113
]
114114

115-
total_bytes = 0
115+
total_gz = 0
116+
total_br = 0
116117
for (target, subtarget), files in sorted(by_package.items()):
117-
# Primary artifact is usually index.html.gz
118-
files_sorted = sorted(files, key=lambda x: (-x[0], x[1]))
119-
total_package = sum(s for s, _ in files)
120-
total_bytes += total_package
121-
primary = files_sorted[0]
122-
size_str = human_size(primary[0])
123-
paths_str = "; ".join(rel for _, rel in files_sorted[:3])
124-
if len(files_sorted) > 3:
125-
paths_str += f" (+{len(files_sorted) - 3} more)"
126-
lines.append(f"| {target} | {subtarget} | {size_str} | {primary[0]} | {paths_str} |")
118+
gz_size = 0
119+
br_size = 0
120+
gz_path = None
121+
br_path = None
122+
for size, rel in files:
123+
if rel.endswith('.gz'):
124+
gz_size = size
125+
gz_path = rel
126+
total_gz += size
127+
elif rel.endswith('.br'):
128+
br_size = size
129+
br_path = rel
130+
total_br += size
131+
gz_str = human_size(gz_size) if gz_size else 'N/A'
132+
br_str = human_size(br_size) if br_size else 'N/A'
133+
gz_path_str = gz_path if gz_path else 'N/A'
134+
br_path_str = br_path if br_path else 'N/A'
135+
lines.append(f"| {target} | {subtarget} | {gz_path_str} | {gz_str} | {br_path_str} | {br_str} |")
127136

128137
lines.extend([
129138
"",
130-
f"**Total size (all packages):** {human_size(total_bytes)} ({total_bytes} bytes).",
139+
f"**Total Gzip size:** {human_size(total_gz)} ({total_gz} bytes).",
140+
f"**Total Brotli size:** {human_size(total_br)} ({total_br} bytes).",
131141
"",
132142
])
133143

0 commit comments

Comments
 (0)