cebe / cebe/php-openapi

Major Performance issue even with new caching?

Abierto
#156 7 comentarios 0 reacciones 0 asignados Ver en GitHub
needs investigation
Lenguaje dominante
PHP
Estrellas
500
Forks
99
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi @cebe

Almost 2 years ago we had a rather big issue with the performance for parsing an API-spec, where all components were store in another (the same) file. It took a couple of minutes to process. My collegue then proposed this PR #65

We ended up using this fork for the last two years now. This week I'm updating dependencies, and having seen that you merged #67 made me realize, that I can finally get rid of our fork.

However, running our test-suite after the update was rather painful: Instead of ~1s to parse our specification, like with our fork, it now took ~30s. I spent a couple of hours analyzing, but I couldn't find the issue. It looks like resolving references is painfully slow, it seems to take 100-300ms for each reference. Clearly, this was much faster in version 1.4, where our fork originates.

---

Therefore, I hope you can find a minute to look into it as well. I prepared a minimal test setup:

```console
$ git clone https://github.com/lextira/openapi-parse-test
$ composer update

# now we have a composer install with our fork, see https://github.com/lextira/openapi-parse-test/blob/master/composer.json
$ php test.php
Start Reading...
Read took 1248 miliseconds!
Parsed file is 791837 characters long.

$ git checkout with-openapi-1.6
$ composer update

# new we are at the latest release of the official repository
$ php test.php
Start Reading...
Read took 37302 miliseconds!
Parsed File is 791837 characters long.
```

So with v1.6, reading the exact same file from the exact same URL takes almost 30 times longer than with v1.4 (and our custom cache implementation, which is very similar to your implemented cache now). For context, the specification used for the test is our official API documentation and can be found here: https://docs.lexgate.ch/api/

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con la reproducción mínima en github.com/lextira/openapi-parse-test y ejecuta test.php contra el fork basado en v1.4 y la versión oficial v1.6. Investiga la ruta de resolución de referencias y el comportamiento de la caché, usando la especificación OpenAPI enlazada como carga de trabajo. Se considera terminado cuando la ruta de v1.6 ya no muestra la regresión de parsing reportada en comparación con el fork.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
openapi, php
Área
api, performance
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.