You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can probably be clever with allocations for ADTs with few parameters. As in, pass them by value rather than allocate memory for all of them. A Maybe or Either type takes up a trivial amount more memory than whatever it contains, so it's probably worth just copying it instead of returning a reference or passing a reference to a function.
If all elements in an ADT only have 1 data slot, pass them by value instead of reference
If a closure environment doesn't contain non root references, make it a function
In version 1 of the compiler we're just making everything a closure, which is a bit pointless for functions that only have root level references
Try to store lists contiguously
The V1 allocator will be pretty dumb with lists, slotting them wherever possible. To utilize the cache better, we should try to store lists in contiguous memory.
Extending onto this, if you map over a list, it can trivially be given a contiguous memory block
Cache compiled library code
Instead of recompiling the entire stdlib for every program, cache the compiled libraries
Use TrieMap to prune redundant expressions and function definitions
The text was updated successfully, but these errors were encountered:
Pass small ADTs by value
We can probably be clever with allocations for ADTs with few parameters. As in, pass them by value rather than allocate memory for all of them. A Maybe or Either type takes up a trivial amount more memory than whatever it contains, so it's probably worth just copying it instead of returning a reference or passing a reference to a function.
If all elements in an ADT only have 1 data slot, pass them by value instead of reference
If a closure environment doesn't contain non root references, make it a function
In version 1 of the compiler we're just making everything a closure, which is a bit pointless for functions that only have root level references
Try to store lists contiguously
The V1 allocator will be pretty dumb with lists, slotting them wherever possible. To utilize the cache better, we should try to store lists in contiguous memory.
Extending onto this, if you
map
over a list, it can trivially be given a contiguous memory blockCache compiled library code
Instead of recompiling the entire stdlib for every program, cache the compiled libraries
Use TrieMap to prune redundant expressions and function definitions
The text was updated successfully, but these errors were encountered: