Sadly, as awesome as WordPress is from a usability standpoint and as great as some themes are from a SEO standpoint, the source code is an utter mess.
And this starts right from the core. I did a plugin once for a customer which needs to run through all published posts (and pages), modify stuff, update it in database. 35k posts in database (including everything else, we have 120k rows in wp_posts and I don't even want to check how many in wp_postmeta). Using $wpdb it was 38 minutes! I then reconsidered the script using PDO and my own connection - same exact SQL queries and it was done after 25 seconds.
And no, I didn't even use the WP API to update the post_content but only MySQL which is why the script was updated fairly quick.
And now the database has surpassed some limit and thus there is a bottleneck somewhere - mysql is always over 100% CPU and load is over 8 most of the time and sometimes over 20. Until some magic happens and it cools down to sub-1. It is so horrible...
A XenForo with well over 1M posts performs A LOT better.