optimization - Why bother allocating activation records at runtime when you could perform an inline expansion of all recursive function definitions at compile time? -
note have read question
and
can recursive function inline?
yet still feel there unresolved edge case of interest here. assume language has following:
- pure first-class functions parameters treated constants (no write-back)
- anonymous inline functions supported (lambda abstraction)
- callbacks/continuations/coroutines/fibers patterns
- tail-call optimisation
- macro expansion
then why bother allocating activation records @ runtime when perform inline expansion of (mutually) recursive function definitions @ compile time? seem reduce calling overhead zero, open opportunities parallel 'simplification' of expressions abstracted behind each functions using standard computer algebra techniques variables can remain unknowns during symbolic reduction - including evaluating multiple branches of condition speculatively , throwing away valid result (something made difficult von neumann bottleneck imposed stack-based approach).
i appreciate not optimisation expand in-place recursive function invocations code-bloat not able take proper advantage of cpu's cache, only interested in using features mentioned in 3. feel pragmatic of limited depth.
Comments
Post a Comment