Paul Backus snarwin at
Thu Oct 28 13:30:53 UTC 2021

On Thursday, 28 October 2021 at 09:02:52 UTC, JG wrote:
> I am heavily using SumType (which I like very much). The 
> problem I am having is that is seems to be causing slow compile 
> times (as can be observed by profiling during the compile). The 
> problem seems to be with match (which is extremely convenient 
> to use). I looked at the code and it does the only reasonable 
> thing too do which is to test each handler against each type. 
> The slow compile time makes development slower and less 
> pleasant, so I am thinking of replacing SumType with my own 
> tagged union and writing out the switches by hand. However, I 
> really don't like this idea since it makes the code less 
> readable and more prone to errors. Any suggestions?

Hi, I'm the author of `SumType`. Thanks for bringing this to my 
attention. The good news is, I have not put a lot of effort so 
far into micro-optimizing the compile-time performance of 
`match`, so there is almost certainly room for improvement.

If you have an example of the kind of code you are seeing poor 
compile-time performance for, I'd be happy to use it as a 
benchmark/profiling target. Any profiling data you've collected 
would also be helpful.

I've created issues for this on Bugzilla and the sumtype Github 

More information about the Digitalmars-d-learn mailing list