Skip to content

Performance issue in removeReflection related to enumerating the project's symbolMapping #891

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

Closed
igandrews opened this issue Oct 30, 2018 · 1 comment

Comments

@igandrews
Copy link
Contributor

I put some of this in the pull request for the fix but I'll re-enter it here.

I have a large project with lots of types and members marked as @hidden. The CommentPlugin stores these in its hidden array and then later will invoke the removeReflection for each. That method may then recursively call itself so it ends up getting invoked for more than the number of hidden items. This is expected. The problem though is that for each invocation the removeReflection completely enumerates the symbolMapping of the project. In my case I had around 35k hidden items. If you include the descendants the removeReflection was invoked around 300k times. So 300k times it completely enumerated the symbolMapping which in my case started with around 90k items.

The pull request that addresses this is here:
#890

While there are probably lots of ways to address this (e.g. maybe it shouldn't even be storing the reflection for a hidden item but instead should return null from createDeclaration like it would for external items) the cleanest way to address this specific problem without significant churn seemed to be to just adjust the removeReflection. So the PR moves the clean up of the symbolMapping to happen after all the hidden items have been cleaned up. Since the removeReflection was called recursively and so would have processed the symbolMapping for those descendants the removeReflection tracks the id's of the reflections it processes so when the removeReflections does clean up the symbolMapping it can process all the items removed.

I'd really appreciate it if this could be accepted as it's preventing me from using the npm packaged version of typedoc. If there's more I can provide please let me know. Thx

@igandrews
Copy link
Contributor Author

This one can be closed since the associated PR was merged. Hope a new package is published soon.

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

No branches or pull requests

1 participant