3 ms·
What I'd like is a language that permits me to trap a dynamic allocations with a knowledge of the callsite. Instead of having specialized objects for manipulat
by vmorgulis 11y ago
What I'd like is a language that permits me to trap a dynamic allocations with a knowledge of the callsite.
Instead of having specialized objects for manipulating memory (like deque<>, vector<> ...), this language would provide statically a profile (or signature) of the stack at compiletime. It would allow the user to apply strategies that are used in JITs (like inline caching).
For example, detect that an array is push or shift only:
- if it's push-only, preallocate memory by chunk (like vector.reserve()).
- if it's shift-only, trap the [] operator and change the head of the array by an offset (no resize)
The issues of GC and malloc are around the context.