Files
newt/scripts/stats.py
Steve Dunham e3ae301c9c performance and code size improvements
- Use default case for constructors with no explicit match.
- self-compile is 15s now
- code size is 60% smaller

code size and self compile time on par with the idris-built version
2025-01-18 21:33:49 -08:00

19 lines
399 B
Python
Executable File

#!/usr/bin/env python3
import sys
fn = sys.argv[1]
stats = {}
acc = ''
name = ''
for line in open(fn):
if line.startswith('const'):
if name: stats[name] = len(acc)
acc = line
name = line.split()[1]
else:
acc += line
if name: stats[name] = len(acc)
sorted_stats = sorted(((v, k) for k, v in stats.items()))
for value, key in sorted_stats:
print(value, key)