From recent postings in this forum, I conclude that the 0.7 compiler has many new optimizations, and I would be interested if someone knowledgeable could explain their reach or else point to a PR in GitHub that describes them. Three in particular come to mind:
Unions: AFAIK: In 0.6, an array of Union objects is inefficient because each entry of the array is boxed. In 0.7, some Union objects are handled with flags instead of boxes.
Tuples and immutable objects containing non-bits types. If
(a,b)is a tuple and
ais a non-bits type, then the tuple in general is heap-allocated. But even as long ago as 0.4, this wasn’t always true, e.g., if the tuple is part of a list of arguments to a function invocation
f((a,b),c,d)then no heap object was allocated. What are cases in 0.7 where heap-allocation of an object containing non-bits types is avoided?
Propagation of constants. In 0.6, the mechanism to propagate constants for compilation into efficient code is the
Valtype. I’ve read in this discourse that constant propagation is much more powerful in 0.7. Is there a PR that describes its reach?