Optimizing the new trait solver

This is a more detailed writeup of all the changes we made in the past months to optimize the performance of the next trait solver. Basically, anything that didn't fit in the blog post on https://blog.rust-lang.org.