tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

execution.js (1447B)


      1 // Execution has no application node/work/frame ceilings. Browser memory remains
      2 // finite; Stop terminates the owning Worker. GC thresholds are not budgets.
      3 export const BROWSER_BUDGET = Object.freeze({ nodes: Infinity, fuel: Infinity, stack: Infinity });
      4 export const PACKAGE_LOAD_MS = 60_000;
      5 // Export is bounded transport/rendering, not program execution.
      6 export const EXPORT_ACTIVE_MS = 120_000;
      7 export const EXECUTION_COLLECTION = Object.freeze({ threshold: 250_000 });
      8 export const PACKAGE_COLLECTION = Object.freeze({ threshold: 100_000 });
      9 export function collectionPolicy(budget, threshold = EXECUTION_COLLECTION.threshold) {
     10     return budget.nodes < 2 ? undefined : { threshold: Math.min(threshold, budget.nodes) };
     11 }
     12 const operationLabels = {
     13     catalogue: 'Program catalogue loading', loading: 'Package loading',
     14     compiling: 'Draft compilation', running: 'Program execution',
     15     exporting: 'Definition export', downloading: 'Bundle download',
     16 };
     17 export function operationFailure(operation, message) {
     18     return operation ? `${operationLabels[operation]} failed: ${message}` : message;
     19 }
     20 export function operationTimeout(operation) {
     21     return operation === 'loading' || operation === 'downloading' || operation === 'catalogue'
     22         ? `${operationLabels[operation]} timed out. The deadline includes transfer and processing time; try again.`
     23         : `${operationLabels[operation]} stopped: active time limit exceeded.`;
     24 }