Skip to content

Change detection de-optimization in Chrome/V8 #5012

@kailniris

Description

@kailniris

Vue.js version

2.2.0
Older versions have this issue too.

Reproduction Link

https://jsbin.com/sujuwabufi/3/edit?html,js,output

Steps to reproduce

The steps must be in order. If any step is skipped or the order is changed the bug does not appears.

  1. Register a global component. The component has to have a watcher, watching a data property or a prop.
  2. Create a Vue instance and attach it to an element in a dom.
  3. Create/get a data set and put it in a shared state. (global object)
  4. Create a new Vue instances with the following criteries and attach it to an element in the dom.
  • The shared state has to be reactive in this instance (put it into the instances data property)
  • The instance has to watch the shared state with a deep watcher.
  • The instance needs a computed property returning any value.
  • The instance needs a computed property returning a value based on the shared state object.
  1. Mutate the shared state. (repro case test button )

What is Expected?

App does not freeze.

What is actually happening?

The app freezes for several seconds, depend on how big the data set is. The reason behind this is change detection triggered for every object in the data set but it should only for the watcher one time and for the computed property one time.

One thing to note is this only happen one time after the first mutation. After that everything work as intended.

Here is a profiling
timeline

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions