Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

js framework benchmark - Huge performance drop after upgrading mobx and mobx-react to latest version #877

Closed
darkowic opened this issue Jun 17, 2020 · 9 comments · Fixed by krausest/js-framework-benchmark#752

Comments

@darkowic
Copy link

After upgrading react, mobx and mobx-react to latest version in https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/keyed/react-mobX I found huge performance drop in the benchmark. The example is really simple but I don't know what is the problem.

image

How to reproduce the issue

Upgrade react, mobx and mobx-react to the latest version and run the benchmark.

Versions

  "dependencies": {
    "mobx": "5.15.4",
    "mobx-react": "6.2.2",
    "react": "16.13.1",
    "react-dom": "16.13.1"
  }
@darkowic darkowic added the bug label Jun 17, 2020
@mweststrate
Copy link
Member

Shit, yes forget about this.

@FredyC I think we still need to revert the batching-opt-in change? We really can't do that in a minor update, it hurts serious applications really bad and probably no test will detect it.

@danielkcz
Copy link
Contributor

@darkowic So you haven't noticed that "friendly" warning what you need to do?

@darkowic
Copy link
Author

Yeah, I didn't notice any warning

@danielkcz
Copy link
Contributor

And can you please confirm that after following these instructions the performance is back on track?

@darkowic
Copy link
Author

I just checked it. Adding require('mobx-react/batchingForReactDom'); didn't solve it.
[Violation] 'click' handler took 34428ms - creating 10k rows...

You have to take a look at this benchmark I guess.

@danielkcz
Copy link
Contributor

danielkcz commented Jun 18, 2020

Alright, thank you for the report in that case and we will have a closer look.

There are fairly big jumps between versions for mobx (5.0.3 -> 5.15.4) and mobx-react (5.2.3 -> 6.2.2). It will be an interesting discovery path for sure :) Might be a problem of MobX itself.

@mweststrate
Copy link
Member

mweststrate commented Jun 19, 2020

Just tried to narrow this done, it seems that the react update itself causes the difference. As soon as I upgrade to react 6.13.1, the perf drops from 3 to 40 secs, with the same mobx / mobx-react version. Does this ring a bell to anyone?

Edit: drop happens between react 6.5.2 and 6.6.0

Edit: looks like we need to update some build deps: facebook/react#13987

Edit: using Terser fixes the issue indeed.

@darkowic
Copy link
Author

This is mindblowing 🤯 I would not expect minifier to do that... Thank you for the investigation!

@mweststrate
Copy link
Member

Yeah, it's super sad! Glad someone else found that out before, would never have figured that out myself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants