I am using the below package for the graphql integration in laravel.I think the package is slow. While comparing the Graphql Vs REST API in local environment, REST API is very fast compared to the graphql package,but in all the documents I can able to see that grapql is faster than rest API can you comment for the reason guys?
composer require nuwave/lighthouse
REST API - 61 ms with the size of 787.03kb
GraphQL - 744 ms with the size of 806.5kb
Kindly help me, If I am making any mistakes. Please refer the screenshots.
When you directly compare the time it takes to return some fixed data, Lighthouse will always be slower then doing the same through an endpoint that just returns JSON.
A GraphQL server simply does more work, for example:
The strengths of GraphQL become apparent when your queries (or mutations) become larger and more complex. Validation will make sure everything works as intended, and loading of nested relations will allow you to save on round-trips.