Skip to content

[@types/underscore] Collection and Array Tests - Compact and Range#46189

Merged
typescript-bot merged 7 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-compact-range
Jul 24, 2020
Merged

[@types/underscore] Collection and Array Tests - Compact and Range#46189
typescript-bot merged 7 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-compact-range

Conversation

@reubenrybnik
Copy link
Copy Markdown
Contributor

@reubenrybnik reubenrybnik commented Jul 20, 2020

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).
  • Provide a URL to documentation or source code which provides context for the suggested changes: https://underscorejs.org/
  • Include tests for your changes

This PR continues the planned set that will together add up to #45201 and includes the following changes:

@typescript-bot typescript-bot added Where is GH Actions? GH Actions didn't give a response to this PR Popular package This PR affects a popular package (as counted by NPM download counts). Author is Owner The author of this PR is a listed owner of the package. labels Jul 20, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Jul 20, 2020

@reubenrybnik Thank you for submitting this PR!

This is a live comment which I will keep updated.

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners or DT maintainers

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 46189,
  "author": "reubenrybnik",
  "owners": [
    "borisyankov",
    "jbaldwin",
    "ccurrens",
    "confususs",
    "jgonggrijp",
    "ffflorian",
    "regevbr",
    "peterblazejewicz",
    "reubenrybnik"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "d990050",
  "headCommitOid": "d9900505ff7bb6c93d6751c97ef08d7274ef0097",
  "mergeIsRequested": true,
  "stalenessInDays": 0,
  "lastPushDate": "2020-07-22T21:38:05.000Z",
  "lastCommentDate": "2020-07-24T01:44:26.000Z",
  "maintainerBlessed": false,
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46189/files",
  "hasMergeConflict": false,
  "authorIsOwner": true,
  "isFirstContribution": false,
  "popularityLevel": "Popular",
  "anyPackageIsNew": false,
  "packages": [
    "underscore"
  ],
  "files": [
    {
      "path": "types/underscore/index.d.ts",
      "kind": "definition",
      "package": "underscore"
    },
    {
      "path": "types/underscore/underscore-tests.ts",
      "kind": "test",
      "package": "underscore"
    }
  ],
  "hasDismissedReview": false,
  "ciResult": "pass",
  "lastReviewDate": "2020-07-23T23:49:15.000Z",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 2,
  "isChangesRequested": false
}

@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @borisyankov @jbaldwin @ccurrens @confususs @jgonggrijp @ffflorian @regevbr @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot removed the Where is GH Actions? GH Actions didn't give a response to this PR label Jul 20, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #46189 diff
Batch compilation
Memory usage (MiB) 60.4 60.3 -0.2%
Type count 11092 11132 0%
Assignability cache size 1351 1374 +2%
Language service
Samples taken 5657 5735 +1%
Identifiers in tests 5657 5735 +1%
getCompletionsAtPosition
    Mean duration (ms) 182.2 182.1 -0.1%
    Mean CV 10.2% 10.0%
    Worst duration (ms) 352.4 352.0 -0.1%
    Worst identifier _ neverValue
getQuickInfoAtPosition
    Mean duration (ms) 177.6 177.0 -0.3%
    Mean CV 10.5% 10.2% -2.5%
    Worst duration (ms) 384.6 341.0 -11.3%
    Worst identifier _ extractChainTypes

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Jul 20, 2020
Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

There are some details that I think need sorting, but as always, this definitely looks like it's going to be an improvement.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Jul 21, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@reubenrybnik One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you!

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

@jgonggrijp I'm at a point where I'd appreciate some more feedback on all of your comments with no changes yet, but while @typescript-bot claims that I can "dismiss" your review to kick this back to Waiting for Code Reviews, as far as I can tell that requires you to be showing up in the UI below and you don't for some reason. If you wouldn't mind taking another look a this when you have a moment, I'd appreciate it!

image

Also the button below continues to not work and I don't understand why 😞.

image

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Oh, I guess maybe it's because GitHub doesn't think your review counts due to the way this repository is set up 😛. In that case, though, @typescript-bot isn't providing a super accurate message.

image

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Jul 22, 2020

Tossed a quick note into the DefinitelyTyped gitter about the above, but having just noticed the below maybe I should have filed an issue and CC'd RyanCavanaugh instead 😬 (not going to at them at this point though since I've already stuck this in a different forum).

image

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Jul 22, 2020
jgonggrijp added a commit to jgonggrijp/underscore that referenced this pull request Jul 22, 2020
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Or maybe I just wasn't patient enough since it says it also reacts to comments and seems to have probably done so on a timer 😞

@jgonggrijp
Copy link
Copy Markdown
Contributor

@reubenrybnik I've responded to your answers to my comments. Is that what you meant, or do you actually want me to go over the code again?

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Nope, that's all I was hoping for, thanks @jgonggrijp! I'll make the requested changes in a bit 😄

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Jul 22, 2020

Actually, your comment #46189 (comment) happened at the same time as the status changes happened, which seems like an odd action to have potentially caused this behavior. 🤷 oh well, gonna stop thinking about it now.

@typescript-bot
Copy link
Copy Markdown
Contributor

@jgonggrijp Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 2b9a663.

Comparison details 📊
master #46189 diff
Batch compilation
Memory usage (MiB) 66.8 55.1 -17.4%
Type count 11533 11575 0%
Assignability cache size 1382 1405 +2%
Language service
Samples taken 6355 6461 +2%
Identifiers in tests 6355 6461 +2%
getCompletionsAtPosition
    Mean duration (ms) 170.6 191.7 +12.4%
    Mean CV 9.5% 8.3%
    Worst duration (ms) 304.1 355.4 +16.9%
    Worst identifier stringListValueIterator neverValue
getQuickInfoAtPosition
    Mean duration (ms) 166.5 187.1 +12.3%
    Mean CV 9.9% 8.4% -14.7%
    Worst duration (ms) 330.9 414.6 +25.3% 🔸
    Worst identifier extractChainTypes extractUnderscoreTypes

Looks like there were a couple significant differences—take a look at worst-case duration for getting quick info at a position to make sure everything looks ok.

@typescript-bot typescript-bot added Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. and removed Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. labels Jul 22, 2020
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

I kind of want to do one more commit just to see if the Perf: Worse label goes away since both links for worst identifiers are pointing at code that I didn't touch in this PR at all.

Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

My approval is conditional on the answer to the question below being "yes".

Well done again!

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Jul 22, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 49c4278. Nice job, these numbers look better.

Comparison details 📊
master #46189 diff
Batch compilation
Memory usage (MiB) 65.5 65.8 +0.4%
Type count 11533 11579 0%
Assignability cache size 1382 1407 +2%
Language service
Samples taken 6355 6469 +2%
Identifiers in tests 6355 6469 +2%
getCompletionsAtPosition
    Mean duration (ms) 162.4 171.8 +5.8%
    Mean CV 10.1% 9.9%
    Worst duration (ms) 294.7 319.8 +8.5%
    Worst identifier _ _
getQuickInfoAtPosition
    Mean duration (ms) 158.5 167.7 +5.8%
    Mean CV 10.3% 10.0% -2.3%
    Worst duration (ms) 294.8 333.1 +13.0%
    Worst identifier extractUnderscoreTypes extractChainTypes

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. and removed Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. Self Merge This PR can now be self-merged by the PR author or an owner Owner Approved A listed owner of this package signed off on the pull request. labels Jul 22, 2020
…rather than testing just null or just undefined directly.
@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 207be20.

Comparison details 📊
master #46189 diff
Batch compilation
Memory usage (MiB) 63.5 55.1 -13.1%
Type count 11533 11574 0%
Assignability cache size 1382 1407 +2%
Language service
Samples taken 6355 6467 +2%
Identifiers in tests 6355 6467 +2%
getCompletionsAtPosition
    Mean duration (ms) 202.7 207.0 +2.1%
    Mean CV 8.2% 7.9%
    Worst duration (ms) 401.8 413.2 +2.8%
    Worst identifier stringRecordProperty _
getQuickInfoAtPosition
    Mean duration (ms) 197.6 202.1 +2.3%
    Mean CV 8.2% 8.2% -1.2%
    Worst duration (ms) 377.3 466.2 +23.5% 🔸
    Worst identifier _ extractChainTypes

Looks like there were a couple significant differences—take a look at worst-case duration for getting quick info at a position to make sure everything looks ok.

@typescript-bot typescript-bot added Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. and removed Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. labels Jul 22, 2020
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Jul 23, 2020

[sigh] @typescript-bot, your input is not consistent and I'm not sure what it indicates aside from that something may possibly get worse somewhere for someone somehow. Completions makes me think compiler maybe, and quick info makes me think maybe stuff like VS Intellisense?

Also, I'm really surprised that dropping an overload in favor of optional parameters and adding null and undefined to a constraint was able to effect a swing from -11.3% at the beginning of this PR to +23.5%; that seems like a pretty big perf change for what seems like a small code change affecting only the range signature 😕

Not saying that those aren't the results of those changes, just that it doesn't make sense to me and I don't feel like I'm provided enough information to understand the potential negative effects and take appropriate action here.

Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. Let's ignore the performance tests and move on.

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Jul 23, 2020
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Jul 24, 2020

No worries, thanks @jgonggrijp! You've been impressively responsive so far during this process, definitely don't feel like you need to respond immediately all the time 😄. My concern earlier was more just around DT providing the correct general indictors for folks to more accurately be able to tell what PRs are ready for additional review, not about you specifically not getting back to me fast enough.

I'm probably not going to completely ignore the performance results since I do think it would be nice to file an issue requesting some additional readme documentation on what those numbers mean from a practical, real-world perspective and what overall durations are getting into "bad" territory (either something concrete like "this is where compilation/IDEs start to seem really laggy" or something more abstract like a comparison to other similarly complex definitions), but I definitely don't feel like these results in particular are worth holding this process up for.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

On the other hand, I suppose if the numbers get concerning I can put the types in a solution and benchmark building or eyeball the speed of something like VS Intellisense. Since after poking about the internet I'm pretty sure getQuickInfoAtPosition is more about the "editor responsiveness" part of what these are supposed to report on, I double-checked quick to make sure that Intellisense seemed reasonably responsive for UnderscoreStatic.compact still since that change seems like the most likely culprit for the degradation here 😄

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Ready to merge

@typescript-bot typescript-bot merged commit 9fb81b3 into DefinitelyTyped:master Jul 24, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

I just published @types/underscore@1.10.13 to npm.

danielrearden pushed a commit to danielrearden/DefinitelyTyped that referenced this pull request Sep 22, 2020
…rray Tests - Compact and Range by @reubenrybnik

* Updating type definitions for compact and range and adding tests.

* Adding a few multi-call chain tests.

* Removing a test I already added in a previous PR.

* Adding back support for null and undefined lists for compact.

* Making the following updates to range: collapsing to single overloads, updating documentation, and adding tests for the stop + step parameter set.

* Adding compact tests for a null collection as well.

* Switching to a test that checks a List | null | undefined type union rather than testing just null or just undefined directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author is Owner The author of this PR is a listed owner of the package. Owner Approved A listed owner of this package signed off on the pull request. Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts). Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@types/underscore error TS2322 for _.chain after upgrade to v1.9

3 participants