Atelier des rouesLab FR
Objects/Documentation

prevision26.py

Predicting memory between collections · prevision26.py

Download ↓
"""Predict selective-collection peaks from automatic increments and all-collection resets."""
import json,subprocess,sys
from statistics import median
from pathlib import Path

def study():
    old=json.loads(Path(__file__).with_name('selectif25.json').read_bytes());out=[]
    for cap in (64,256):
        group=lambda mode:[r for r in old if (r['cap'],r['mode'],r['tracing'])==(cap,mode,1)]
        live=0;forecast=[]
        for i in range(8):
            def increment(row,k):
                prev=row['bytes'][i-1][0] if i else 0
                return row['bytes'][i][k]-prev
            forecast.append(max(0,live+median(increment(r,1) for r in group(0))))
            live=(median(r['bytes'][i][0] for r in group(2)) if i+1 in (2,4,6)

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.