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

Prepare for TS #32460 #37057

Merged
merged 2 commits into from
Jul 23, 2019
Merged

Prepare for TS #32460 #37057

merged 2 commits into from
Jul 23, 2019

Conversation

ahejlsberg
Copy link
Collaborator

@ahejlsberg ahejlsberg commented Jul 22, 2019

Prepare react-dom and react-test-renderer for microsoft/TypeScript#32460.

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). The Travis CI build failed labels Jul 22, 2019
@typescript-bot
Copy link
Contributor

typescript-bot commented Jul 22, 2019

@ahejlsberg Thank you for submitting this PR!

🔔 @MartynasZilinskas @theruther4d @Jessidhia @arvitaly @lochbrunner @johnnyreilly @jgoz - 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.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Contributor

typescript-bot commented Jul 22, 2019

@ahejlsberg The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick performance metrics against master and your PR. This is still an experiment, so don’t panic if I say something crazy! I’m still learning how to interpret these metrics.

Let’s review the numbers, shall we?

react-dom/v16

Comparison details for react-dom/v16 📊
master #37057 diff
Batch compilation
Type count 52913 52936 0.0%
Assignability cache size 52867 52890 0.0%
Subtype cache size 236 240 +1.7%
Identity cache size 92 89 -3.3%
Language service
Samples taken 1835 367 -80.0%
Identifiers in tests 367 367 0.0%
getCompletionsAtPosition
    Mean duration (ms) 629.7 659.5 +4.7%
    Median duration (ms) 624.5 651.2 +4.3%
    Mean CV 7.3%
    Worst duration (ms) 807.1 808.0 +0.1%
    Worst identifier React TestComponent
getQuickInfoAtPosition
    Mean duration (ms) 568.2 580.4 +2.1%
    Median duration (ms) 549.3 571.3 +4.0%
    Mean CV 8.6%
    Worst duration (ms) 787.0 769.6 -2.2%
    Worst identifier createElement createElement
System information
Node version v10.15.3 v10.16.0
CPU count 2 2
CPU speed 2.294 GHz 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1041-azure 4.15.0-1047-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.

react-test-renderer/v16

Comparison details for react-test-renderer/v16 📊
master #37057 diff
Batch compilation
Memory usage (MiB) 133.0 134.4 +1.0%
Type count 51648 51662 0.0%
Assignability cache size 52553 52569 0.0%
Subtype cache size 182 186 +2.2%
Identity cache size 47 44 -6.4%
Language service
Samples taken 145 145 0.0%
Identifiers in tests 145 145 0.0%
getCompletionsAtPosition
    Mean duration (ms) 609.4 621.1 +1.9%
    Median duration (ms) 601.6 618.1 +2.8%
    Mean CV 8.5% 9.7% +15.1%
    Worst duration (ms) 801.4 777.2 -3.0%
    Worst identifier TestComponent TestComponent
getQuickInfoAtPosition
    Mean duration (ms) 556.8 565.0 +1.5%
    Median duration (ms) 550.7 555.4 +0.9%
    Mean CV 9.1% 10.0% +9.6%
    Worst duration (ms) 665.8 716.0 +7.5%
    Worst identifier map testInstance

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.

storage-helper/v1

Comparison details for storage-helper/v1 📊
master #37057 diff
Batch compilation
Memory usage (MiB) 35.4 32.4 -8.6%
Type count 2039 2061 +1.1%
Assignability cache size 99 105 +6.1%
Subtype cache size 0 0
Identity cache size 0 0
Language service
Samples taken 44 44 0.0%
Identifiers in tests 44 44 0.0%
getCompletionsAtPosition
    Mean duration (ms) 93.0 93.6 +0.6%
    Median duration (ms) 79.1 82.4 +4.1%
    Mean CV 30.1% 29.6% -1.6%
    Worst duration (ms) 124.5 123.5 -0.8%
    Worst identifier removeItem storageHelper
getQuickInfoAtPosition
    Mean duration (ms) 86.2 88.4 +2.6%
    Median duration (ms) 80.5 85.3 +5.9%
    Mean CV 23.8% 26.0% +9.1%
    Worst duration (ms) 113.4 118.7 +4.7%
    Worst identifier showStorageLogger clear

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.


If you have any questions or comments about me, you can ping @andrewbranch. Have a nice day!

@typescript-bot
Copy link
Contributor

Updated numbers for you here from 612754b:

react-dom/v16

Comparison details for react-dom/v16 📊
master #37057 diff
Batch compilation
Type count 52913 52936 0.0%
Assignability cache size 52867 52890 0.0%
Subtype cache size 236 240 +1.7%
Identity cache size 92 89 -3.3%
Language service
Samples taken 1835 367 -80.0%
Identifiers in tests 367 367 0.0%
getCompletionsAtPosition
    Mean duration (ms) 629.7 682.8 +8.4%
    Median duration (ms) 624.5 674.6 +8.0%
    Mean CV 7.6%
    Worst duration (ms) 807.1 845.3 +4.7%
    Worst identifier React document
getQuickInfoAtPosition
    Mean duration (ms) 568.2 603.0 +6.1%
    Median duration (ms) 549.3 595.6 +8.4%
    Mean CV 9.0%
    Worst duration (ms) 787.0 779.9 -0.9%
    Worst identifier createElement createPortal
System information
Node version v10.15.3 v10.16.0
CPU count 2 2
CPU speed 2.294 GHz 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1041-azure 4.15.0-1047-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.

react-test-renderer/v16

Comparison details for react-test-renderer/v16 📊
master #37057 diff
Batch compilation
Memory usage (MiB) 134.5 125.0 -7.1%
Type count 51648 51662 0.0%
Assignability cache size 52553 52569 0.0%
Subtype cache size 182 186 +2.2%
Identity cache size 47 44 -6.4%
Language service
Samples taken 145 145 0.0%
Identifiers in tests 145 145 0.0%
getCompletionsAtPosition
    Mean duration (ms) 629.1 631.0 +0.3%
    Median duration (ms) 625.2 628.7 +0.6%
    Mean CV 8.8% 7.4% -15.8%
    Worst duration (ms) 767.8 776.6 +1.1%
    Worst identifier deep TestComponent
getQuickInfoAtPosition
    Mean duration (ms) 577.2 568.3 -1.5%
    Median duration (ms) 569.0 559.4 -1.7%
    Mean CV 9.2% 8.5% -6.7%
    Worst duration (ms) 701.6 710.8 +1.3%
    Worst identifier testInstance getMountedInstance

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.

// but having an "| {}" makes it harder to accidentally use.
export function act(callback: () => void | undefined): DebugPromiseLike | {};
// the actual return value is always a "DebugPromiseLike".
export function act(callback: () => void | undefined): DebugPromiseLike;
Copy link
Contributor

Choose a reason for hiding this comment

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

@Jessidhia Without | {}, you could call act().then(...) without a cast - is that correct? Is there some other way to make it harder to use this (presumably internal) API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is still really hard to call act.then(...) because you get a compile error unless you pass two callbacks that each return never.

The type {} | DebugPromiseLike is definitely suspicious. Ordinarily the compiler would just reduce it to {} (since DebugPromiseLike is a subtype of {}), but for reasons of efficiency and backwards compatibility we don't always reduce unions. With the changes in microsoft/TypeScript#32460 we now infer {} for T when inferring from {} | DebugPromiseLike to T | PromiseLike<T>, which certainly is a better inference than the previous {} | DebugPromiseLike.

@ahejlsberg ahejlsberg merged commit b4584a2 into master Jul 23, 2019
@ahejlsberg ahejlsberg deleted the prepare-for-ts32460 branch July 23, 2019 17:15
@typescript-bot
Copy link
Contributor

I just published @types/react-dom@16.8.5 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/react-test-renderer@16.8.3 to npm.

iRON5 pushed a commit to iRON5/DefinitelyTyped that referenced this pull request Aug 13, 2019
breeze9527 pushed a commit to breeze9527/DefinitelyTyped that referenced this pull request Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Popular package This PR affects a popular package (as counted by NPM download counts).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants