Closed dckc closed 3 years ago
In a fat-pointer implementation, a generic optimization is available. Each fat pointer points to a script and a closure; instead of storing an array of fat pointers, a list could have a single script and an array of closures.
This can't possibly be outdone for anything where we'd need a full word per closure. For bytestrings and Unicode strings, we'll use packed formats already, so really the only wasteful case is List[Char]
.
I implemented this in e720df286d83b321fdb9f5b0755acdcfae431785 and made it usable in be868e4331bc053965724d45df5fdb3a6d893ad4.
I had to unwind a Hal-stack in order to benchmark this. The change from .diverge()
to .diverge(Int)
in the bench/montstone
benchmark is currently about a 3.01x slowdown. I will accept that getting better here will basically require us to somehow totally internalize and erase the guard. However, I accomplished what I wanted to accomplish, and we got a non-trivial improvement.
...