generics-sop icon indicating copy to clipboard operation
generics-sop copied to clipboard

WIP: Revive compact representation for NP/NS

Open edsko opened this issue 3 years ago • 7 comments

This is an attempt to revive https://github.com/well-typed/generics-sop/tree/compact-representation .

edsko avatar Jan 14 '21 09:01 edsko

I just came to repo to see if it would be possible to have a more compact representation of NS, could a similar thing be done using

data NS (f :: k -> Type) (ts :: [k]) = NS Word Any

I’m less sure if it would have as much of a performance improvement as the rest of this PR, but it would definitely improve memory usage.

axman6 avatar Jan 18 '21 16:01 axman6

Yes, that's certainly possible. The original branch from which I was working does in fact do that.

For my current purposes however, it turns out this representation is still not quite good enough, so I'm not sure if this work will go anywhere right now.

edsko avatar Jan 19 '21 07:01 edsko

Ah great, I found the branch and it looks like it was a little more complicated than I expected (I had started playing with an implementation of the idea this afternoon but ran into some of the issues that the original branch ran into, such a making instances for Show, Eq etc. work)

I would be really keen to see some benchmarks before and after with the original, your PR's work, the compact NS implementation, and both (though I understand if you aren't keen do the last two).

axman6 avatar Jan 19 '21 08:01 axman6

Perhaps @kosmikus did some on the original compact representation branch?

edsko avatar Jan 19 '21 08:01 edsko

I did only do runtime benchmarking, and I wasn't too impressed. I think staging is the far superior approach for runtime performance. Compile-time is a different question though.

If the goal is that any compact-representation branch would become the default at any point, it needs thorough benchmarking though. I don't want to replace a safe implementation with a potentially unsafe one for questionable / not noticeable gain.

kosmikus avatar Feb 22 '21 15:02 kosmikus

FWIW, I've started working on porting the rest of the old compact-representation branch.

kosmikus avatar Apr 10 '21 20:04 kosmikus

Is there any word on progress of this PR?

ghost avatar Oct 27 '21 05:10 ghost