A client had recently pointed out to me a post detailing performance differences between the REST API that ships in WordPress Core, and WPGraphQL —
https://www.wpgraphql.com/docs/wpgraphql-vs-wp-rest-api#performance
In it, it asserts that the difference between two similar queries running the REST API and WPGraphQL yields vastly different performance impacts:
Below are screenshots of the same WordPress site asking for 100 posts from the WP REST API and 100 posts from WPGraphQL with the Chrome network tab open.
REST:
- Download size: 335 kb
- Time: 7.91s
WPGraphQL
- Download size: 6.4 kb
- Time: 67 ms
That seemed like an unrealistic difference from an initial glance — the REST API takes over 100x longer to return data than WPGraphQL? I wanted to check and see if I could duplicate the test and find out what accounted for the orders of magnitude difference between the two.
(more…)