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
Source: https://managewp.org/articles/15279/wordpress-rest-api-versus-custom-request-handlers


Source: https://williechiu40.wordpress.com/2017/06/06/wordpress-rest-api-versus-custom-request-handlers/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s