I heard a story in the name of Rav Shmuel Auerbach which is incredible, but I was hoping someone can confirm if it's true or not.
He says that during the times of the Shach (Sifsei Kohen commentary on Shulchan Aruch) there was a huge persecution going which Jews were getting killed in what was called the Chmielnicki massacre; tens of thousands of Jews. The Satan comes to 3 Gedolim of that generation and says if you are willing to die I will stop the gezeira against the Jewish people. 2 of them agreed and when he went to the Shach, the Shach said yes, but come back to me in 3.5 months. So the Satan says why in 3.5 months. He said because that’s about how long it will take for me to finish up the Shach.
The question is how can the Shach sacrifice so many Jews, and Jews who would be learning Torah, so he can write the Shach? The answer I heard is because he understood that the Jews could persevere through this and any persecution, but the Jewish nation needed the Shach to continue. He felt that it would help the Jews with the galus.
Rav Auerbach says that he can tell that in some pieces of the Shach he can see how it was rushed.