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

removeAnnotation performance #1629

Open
momala454 opened this issue Jul 15, 2024 · 1 comment
Open

removeAnnotation performance #1629

momala454 opened this issue Jul 15, 2024 · 1 comment
Labels

Comments

@momala454
Copy link
Contributor

momala454 commented Jul 15, 2024

When using a pathfilter to remove paths, the calls to removeAnnotation are slow.
On my code, it takes around 0.3s for each call to it. I think that I have 333 endpoints

it is "traverseAnnotations" which is slow, not the detaching, as if I comment it, it still take the same time

$this->traverseAnnotations($root, function ($item) use ($remove) {
            if ($item instanceof \SplObjectStorage) {
                foreach ($remove as $annotation) {
                    //$item->detach($annotation);
                }
            }
        });

I don't know if it can be optimised.

Generating a swagger takes 45s with a filter that remove almost all endpoints, while without filter it takes 8 seconds

edit: on my code, i can remove all code after $callable($root) on traverseAnnotations, because the filtered path is directly written. I'm not sure if it's necessary to parse all properties to know the path ?

@DerManoMann
Copy link
Collaborator

Well, the tests still pass without recursion. However, removal of unused components might be affected without. Perhaps we can make the recursive part optional...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants