Implement structure inlining #359
Labels
enhancement
New feature or request
performance
Issues related to performance of generated code
research project
Where a member of one structure type is an instance of another, consider embedding the inner structure directly in the outer one. This will save an allocation, an indirection every time the inner structure is accessed, and a word of memory. This is the difference between (in C)
and
The cost of doing this is that duplicating the outer structure entails copying the inner one, too, so more memory must be allocated and copied (ie, the data structure is not persistent). Also, destructively modifying the outer structure to replace the inner one would require copying the whole inner structure, rather than just storing one pointer, so we wouldn't want to always do this. Obviously, we can't do it for a recursive structure.
Finding a heuristic for determining when this is desirable is an interesting research project.
The text was updated successfully, but these errors were encountered: