sedited/thecharlatan, Bitcoin Kernel developer and Bitcoin Core maintainer, blog post on validation logic in Bitcoin Core:
"Block validation logic in Bitcoin Core is surprisingly complex. After more than a decade of engineering towards improving performance, Bitcoin Core has accumulated many caching layers, sub-steps, and optimizations before the node even calls the script interpreter. In the following, I’ll describe in broad strokes what these are, first roughly describing what validation is done in which order, then explaining why it was implemented in the way it is and the tradeoffs involved"...