dingo / dingo/api

Is 'api.routes' instance required?

Open
#1,733 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

| Q | A
| ----------------- | ---
| Bug? | no
| New Feature? | no
| Framework | Laravel
| Framework version | 7.14.1
| Package version | 3.0.0
| PHP version | 7.4.6

We were seeing drastic performance degradation after upgrading from Laravel 5.6, Dingo v2.0.0, PHP 5.6 to Laravel 7.14, Dingo v3.0.0, PHP 7.4, and when profiling the code Dingo was slowing things down a lot, even when the routes were cached.

After digging in further today, I narrowed it down to the \Dingo\Api\Routing\Router::setAdapterRoutes method, in particular the 'api.routes' instance being set by \Dingo\Api\Routing\Router::getRoutes which runs \Dingo\Api\Routing\Router::createRoute on every defined route and was taking multiple seconds on every request - I couldn't find anywhere this instance was being used, so created my own version of the Router class to avoid performing that second step and performance is vastly improved while seemingly not having affected functionality.

I just wanted to check in here and see if anybody with more in-depth knowledge of Dingo might let me know if I'm missing anything here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.