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

perf(reactivity): should not track __v_isRef and some methods in pr… #1392

Merged
merged 2 commits into from
Jun 25, 2020

Conversation

underfin
Copy link
Member

@underfin underfin commented Jun 17, 2020

…ototype.eg.toString

Reproduction

 const App = {
    setup: () => {
      const data = reactive( {
        array: [1],
        object: {a: 1}
      } );

      return { data }
    },
    renderTracked(e) {
      console.log('key', e)
    },
    template: `
      <div  :literal="data.object" :obj="data.array.map((e) => e)"></div>
    `
  }

  let app = createApp(App);
  app.mount("#app");

Current Behavior

image

Changed Behavior

image

I'm not sure for this.I think it is helpful for better performance.If you agree with me, I will add some test for it.

@yyx990803
Copy link
Member

This adds the cost of the hasOwn checks to every get access, which is likely even more expensive.

@yyx990803
Copy link
Member

Multiple hasOwn checks are expensive, in addition, it's not entirely safe to skip these keys - for example, the user may add a new property named map to an object and this would cause it to not be tracked on the initial run when map is not on the object yet.

@yyx990803 yyx990803 merged commit c43a6e6 into vuejs:master Jun 25, 2020
@underfin underfin deleted the not-track-some-thing branch June 26, 2020 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants