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

Support for JSDoc in services #15856

Merged
8 commits merged into from
May 22, 2017
Merged

Support for JSDoc in services #15856

8 commits merged into from
May 22, 2017

Conversation

ghost
Copy link

@ghost ghost commented May 15, 2017

Fixes #2452 and #14397
Does not fix #15855, #15853, or #13371

Notes:

  • We now always bind jsdoc, even in typescript files. This doesn't necessarily mean that we'll get a good Symbol, but at least parent pointers will be set. I'll have to test how this branch affects performance.

  • forEachChild is now typed as providing a NodeArray<Node> to cbNodeArray instead of a Node[]. We already had casts to this effect.

  • .getChildren() on a JSDocComment node used to provide a garbage array of "tokens" as if the content was TypeScript code. Now avoid collecting tokens at all and just have it be the array of nodes from forEachChild.

@mhegazy
Copy link
Contributor

mhegazy commented May 15, 2017

We now always bind jsdoc, even in typescript files. This doesn't necessarily mean that we'll get a good Symbol, but at least parent pointers will be set. I'll have to test how this branch affects performance.

Why do we need to do this all the time? can we just do the resolution on demand when an operation is needed in a jsdoc?

can you please share the perf numbers.

//// * @param /**/[|foo|] I pity the foo
//// */
////function f([|foo|]: number) {
//// return foo;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this one be marked as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh, shouldn't have left this in. We don't support goto-implementation for parameters anyway.

@ghost
Copy link
Author

ghost commented May 16, 2017

The current baselines show no significant change.

Monaco - node (v7.10.0, x64) |

Project Baseline Current Delta Best Worst
Memory used 359,036k (± 0.00%) 359,062k (± 0.01%) +25k (+ 0.01%) 359,038k 359,087k
Parse Time 2.00s (± 0.67%) 2.00s (± 0.95%) +0.00s (+ 0.08%) 1.98s 2.02s
Bind Time 0.80s (± 2.27%) 0.80s (± 2.13%) +0.00s (+ 0.31%) 0.78s 0.82s
Check Time 3.99s (± 1.83%) 3.97s (± 0.88%) -0.02s (- 0.44%) 3.93s 3.99s
Emit Time 2.71s (± 1.41%) 2.65s (± 0.57%) -0.07s (- 2.43%) 2.63s 2.66s
Total Time 9.49s (± 1.22%) 9.41s (± 0.59%) -0.08s (- 0.84%) 9.37s 9.47s

TFS - node (v7.10.0, x64)

Project Baseline Current Delta Best Worst
Memory used 312,738k (± 0.01%) 312,728k (± 0.03%) -9k (- 0.00%) 312,632k 312,795k
Parse Time 1.45s (± 0.34%) 1.46s (± 0.96%) +0.01s (+ 0.62%) 1.44s 1.47s
Bind Time 0.74s (± 1.12%) 0.74s (± 1.76%) +0.00s (+ 0.54%) 0.73s 0.76s
Check Time 3.40s (± 0.43%) 3.44s (± 0.99%) +0.03s (+ 0.98%) 3.39s 3.47s
Emit Time 2.41s (± 0.61%) 2.39s (± 1.11%) -0.02s (- 0.73%) 2.37s 2.43s
Total Time 8.01s (± 0.25%) 8.03s (± 0.76%) +0.03s (+ 0.31%) 7.95s 8.08s

This may just be because our test cases don't use JSDoc very much, although that is probably representative of real code.
If we want to do #13371 we will probably want to bind the JSDoc anyway. The problem is that trying to set parent pointers on demand would lead to a lot of extra code every time we traverse down a tree, and we'd also likely miss some and get lots of NPEs in services, where we generally always assume a parent pointer to be set.

@mhegazy
Copy link
Contributor

mhegazy commented May 16, 2017

if so, then you want to make sure that all the special handling of jsdoc tags in the binder is limited to js files, e.g. @typedef declaring a type, or @property and @type generating symbols.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the perf tests one more time. the binder has been historically sensitive to reorganizing the bind function

@ghost
Copy link
Author

ghost commented May 22, 2017

OK, looks like performance is still fine.

Monaco - node (v7.10.0, x64)

Project Baseline Current Delta Best Worst
Memory used 359,897k (± 0.00%) 359,932k (± 0.00%) +35k (+ 0.01%) 359,910k 359,966k
Parse Time 2.00s (± 0.37%) 2.01s (± 0.77%) +0.01s (+ 0.65%) 1.98s 2.05s
Bind Time 0.79s (± 0.52%) 0.80s (± 0.75%) +0.01s (+ 0.80%) 0.78s 0.81s
Check Time 3.96s (± 0.35%) 3.98s (± 0.29%) +0.02s (+ 0.61%) 3.96s 4.00s
Emit Time 2.70s (± 0.54%) 2.70s (± 0.41%) +0.00s (+ 0.12%) 2.68s 2.72s
Total Time 9.44s (± 0.18%) 9.49s (± 0.30%) +0.05s (+ 0.51%) 9.41s 9.54s

TFS - node (v7.10.0, x64)

Project Baseline Current Delta Best Worst
Memory used 313,022k (± 0.01%) 313,056k (± 0.01%) +34k (+ 0.01%) 312,935k 313,091k
Parse Time 1.48s (± 2.95%) 1.44s (± 1.00%) -0.04s (- 2.52%) 1.39s 1.46s
Bind Time 0.77s (± 3.43%) 0.77s (± 2.97%) -0.00s (- 0.13%) 0.73s 0.84s
Check Time 3.50s (± 1.63%) 3.44s (± 0.42%) -0.06s (- 1.82%) 3.42s 3.48s
Emit Time 2.41s (± 1.96%) 2.35s (± 0.69%) -0.06s (- 2.50%) 2.32s 2.39s
Total Time 8.17s (± 2.01%) 8.00s (± 0.25%) -0.17s (- 2.02%) 7.96s 8.04s

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Services for @typedef Feature: update JSDoc blocks upon refactoring
2 participants