WordPress REST API versus Custom Request Handlers

Last year I wrote a blog post comparing the performance of using admin-ajax.php and the WordPress REST API, and found that the REST API was about 16% faster than using the traditional AJAX API. While that was a solid improvement, quite a few developers (myself included) were wondering how the REST API compares to using completely custom endpoints. Since the REST API loads most of WordPress core and any active plugins, it should be quite a difference! There’s little doubt that a custom endpoint will be faster, but it should be interesting to see how much faster it will be. It’s also worth taking a look to see if a custom endpoint makes sense from a development and future support perspective.
Defining Custom Request Handlers
There are a few different ways to set up custom endpoints. The fastest possible endpoint would likely be completely independent of WordPress, and could be as simple as a standalone PHP file that is uploaded to the web server. While fast, it probably wouldn’t be all that helpful, because we won’t have access to any WordPress core functions which often save a great deal of development time.
Speeding Things Up with SHORTINIT
The next fastest approach