MCPcopy Create free account
hub / github.com/vercel/vercel / aggregate_by_crate

Function aggregate_by_crate

packages/python-analysis/scripts/profile-wasm.py:382–397  ·  view source on GitHub ↗

Aggregate sizes by crate and section type.

(entries)

Source from the content-addressed store, hash-verified

380
381
382def aggregate_by_crate(entries):
383 """Aggregate sizes by crate and section type."""
384 crate_sizes = defaultdict(lambda: {"code": 0, "rodata": 0, "data": 0, "total": 0})
385
386 for section, crate, _symbol, size in entries:
387 if section == "CODE":
388 crate_sizes[crate]["code"] += size
389 elif section == ".rodata":
390 crate_sizes[crate]["rodata"] += size
391 elif section in (".data", ".bss", ".data.rel.ro"):
392 crate_sizes[crate]["data"] += size
393 else:
394 continue
395 crate_sizes[crate]["total"] += size
396
397 return dict(crate_sizes)
398
399
400def build_folded_stacks(entries, category):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected