Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My experience using the lib. Inputs for performance improvement #105

Open
SOHELAHMED7 opened this issue Mar 23, 2021 · 1 comment
Open
Assignees
Labels
enhancement New feature or request needs investigation Work is needed to figure out the root cause of the problem.

Comments

@SOHELAHMED7
Copy link

First of all, Thanks for this amazing library.

I am using this library and would like to share experience that will give you data when you refactor code to improve performance

  • When $openapi object is initialised by reading spec file it is taking significant time that can be reduced ($openapi = Reader::readFromJsonFile(realpath('openapi_spec.json'));)
  • When I print_r a Schema object (cebe\openapi\spec\Schema) it takes a lot of time, browser crashes sometimes. (Workaround print_r property directly echo $schema->title)
  • Above issue also occurs when I try to print other object such as MediaType
  • php.ini: max_execution_time & memory_limit are needed to increase. If possible, changes can be made to be within limit of PHP defaults

Note: I have not done concrete profiling. This are just my primary observation while using the lib

I will share further experiences when I go come across any

@cebe cebe added enhancement New feature or request needs investigation Work is needed to figure out the root cause of the problem. labels Mar 23, 2021
@cebe cebe added this to the 1.6.0 milestone Mar 23, 2021
@cebe cebe self-assigned this Mar 23, 2021
@samizdam
Copy link

samizdam commented May 24, 2021

When $openapi object is initialised by reading spec file it is taking significant time that can be reduced ($openapi = Reader::readFromJsonFile(realpath('openapi_spec.json'));)

I think result shoud be cached. Two ways:

  1. Cache in user space (need example in library documentation)
  2. Cache as vendor feature - need CachebleReader implementation
  3. PSR-6 integration support - accept user defined implementation injection

Last approach is best practice.

Currently, I'm use parsing for build app routing powered by spec with FastRoute (https://github.com/FreeElephants/json-api-php-toolkit/blob/be6041c5f6fd586e19d3bf1ba3b3b4030e260c11/src/FreeElephants/JsonApiToolkit/Routing/FastRoute/CacheableDispatcherFactoryProxy.php for example).

@cebe cebe removed this from the 1.6.0 milestone Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs investigation Work is needed to figure out the root cause of the problem.
Projects
None yet
Development

No branches or pull requests

3 participants