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

Performance improvement suggestion #14

Open
tobiu opened this issue May 23, 2020 · 0 comments
Open

Performance improvement suggestion #14

tobiu opened this issue May 23, 2020 · 0 comments

Comments

@tobiu
Copy link

tobiu commented May 23, 2020

Hi @onury,

i just played a bit with jsdocx.filter().

for building https://github.com/neomjs/neo JSDoc can return 14.000+ items (this task takes around 2s).

the call:

https://github.com/onury/jsdoc-x/blob/master/src/index.js#L285

docs = _.reduce(docs, (memo, symbol) => {/**/});

ended up with 140s+ on a very fast machine.

I added the following change locally:

if (!options.undocumented) {
    docs = docs.filter(symbol => {
        return !symbol.undocumented || utils.isConstructor(symbol)
    });
}

docs = _.reduce(docs, (memo, symbol) => {/**/});

this pre-filtering reduced the amount of items from 14k to 2.7k and the following reduce call from 140s to 3s.

we could probably get a bit faster with replacing _.reduce with Array.reduce(), but this one was at least for me the main bottleneck.

adding the change to the lib would be appreciated (will use an override for the mean time).

thx & best regards, tobias

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