Code Monkey home page Code Monkey logo

vue-perf-devtool's Introduction

Vue Performance Devtool

Vue Performance Devtool is a browser extension for inspecting the performance of Vue Components. It statistically examines the performance of Vue components based on the measures which are collected by Vue using window.performance API.

logo

Initially started after reading React Performance Devtool and created from Vue Devtool.

Installation

The below extensions represent the current stable release.

Implementation

To use this performance devtool extension, you'll need to allow vue-devtools inspection and performance

// make sure to set this synchronously immediately after loading Vue and before `new Vue`
Vue.config.devtools = true
Vue.config.performance = true

Note: if you keep Vue.config.performance = true on production, you will also be able to use Vue official devtools in the production build. If you don't want that, you can toggle the config to false by using an environment variable:

Vue.config.performance = process.env.NODE_ENV !== 'production'

Uses

  • Remove or unmount the component instances which are not being used.
  • Inspect what is blocking or taking more time after an operation has been started.
  • Examine which components are taking more time to load.

Description

demo

  • Init: Time taken in "beforeCreated" and "created" of lifecycle.
  • Render: Time taken to create the instance in javascript.
  • Patch: Time taken to render in dom.

Development

  1. Clone this repo
  2. npm install
  3. npm run dev
  4. A plain shell with a test app will be available at localhost:8080.

Testing as Firefox addon

  1. Install web-ext

    $ npm install --global web-ext
    

    Or, for Yarn:

    $ yarn global add web-ext
    

    Also, make sure PATH is set up. Something like this in ~/.bash_profile:

    $ PATH=$PATH:$(yarn global bin)
    
  2. Build and run in Firefox

    $ npm run build
    $ npm run run:firefox
    

    When using Yarn, just replace npm with yarn.

Acknowledgments

Special thanks to Evan You and vue-devtool contributors

License

MIT

vue-perf-devtool's People

Contributors

posva avatar rafaesc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-perf-devtool's Issues

Crashes on load in backend.js

backend.js:formatted:347 Uncaught TypeError: Cannot read property 'classList' of null
at Object.10 (backend.js:formatted:347)
at n (backend.js:formatted:11)
at Object.0 (backend.js:formatted:102)
at n (backend.js:formatted:11)
at Object.15 (backend.js:formatted:697)
at n (backend.js:formatted:11)
at Object.6 (backend.js:formatted:4305)
at n (backend.js:formatted:11)
at Object.74 (backend.js:formatted:4754)
at n (backend.js:formatted:11)

This line in particular:

    s && document.body.classList.add("platform-linux")

UI is empty :(

No new measurements on Vue Router link

When loading a page, it correctly discovers everything, but when navigating to a new page, it doesn't register the new components. It requires a reload on that new page.

Why this is important:

It is very useful to be able to see the performance when switching views, because this is an important metric for perceived speed of the app.

Any plans to support this project?

The last update was on 2018, and the forks do not have any noticeable changes.

If anyone is volunteering to revive the project, feel free to write in this issue, as it would be nice to have multiple people participating in one project, rather than having multiple aimless forks.

NaNms

Upon initial load (and some after load is finished), some of the times show as NaNms. Maybe a check in the milliseconds filter for if it is a number, and display -- or N/A could be helpful?

Identifier 'o' has already been declared.

I get an error on every page after installing this in Chrome:

content_script_bundle.js:1 Uncaught SyntaxError: Identifier 'o' has already been declared
    at s (content_script_bundle.js:1)
    at content_script_bundle.js:1
    at content_script_bundle.js:19
    at s (content_script_bundle.js:1)
    at o (content_script_bundle.js:1)
    at Object.<anonymous> (content_script_bundle.js:1)
    at content_script_bundle.js:19
    at content_script_bundle.js:1
    at Object.<anonymous> (content_script_bundle.js:19)
    at Object.1134 (content_script_bundle.js:19)

Make Columns sortable

Hey thanks for this nice tool.

Still I have one thing on my wishlist: sorting. It would be fantastic to be able to sort the results ba the various metrics (total, render, etc.)

Usage tips with quasar framework

Hello, im wonder any of you use performance dgevtool with quasar framework? https://github.com/quasarframework/quasar

Setting Vue.config.performance = true; just before new Vue should be enough, but my experiment with setting this property in boot file was not enough to enable this browser plugin correctly. Any of you guys have some expirience with quasar framework?

Extension breaks LinkedIn website when running

This likely happens elsewhere but this is where I noticed it. When the extension is installed in Chrome (Version 63.0.3239.132 (Official Build) (64-bit) - Mac) the links on LinkedIn.com fail to execute as they appear to be intercepted by the extension which throws a JS error.
sshot- 2018-02-13 at 9 38 12 am

Disabling the extension causes the website to work as expected.

Conflict with latest version of Vue DevTools (5.x)

There is a conflict with the recent versions of Vue DevTools (5.x+) which is described in issue #914

More specifically, this is related to some additional code inside the hook.once("vuex:init" callback which is missing in Vue-Perf-DevTool. The problem manifests itself by Vue DevTools not being able to detect the presence of Vuex store.

The workaround is to disable the Vue-Perf-DevTool extension - but the current implementation of the Performance tab in the recent Vue DevTools is not so informative. So the solution is to add the missing code and update the hook in Vue-Perf-DevTool to reflect the hook in Vue DevTools:

/src/backend/hook.js:

  hook.once('vuex:init', store => {
    hook.store = store
   
   // === the following code must be added ===

    hook.initialStore = {
      state: clone(store.state),
      getters: store.getters
    }
    // Dynamic modules
    if (store.registerModule) {
      hook.storeModules = []
      const origRegister = store.registerModule.bind(store)
      store.registerModule = (path, module, options) => {
        if (typeof path === 'string') path = [path]
        hook.storeModules.push({ path, module, options })
        origRegister(path, module, options)
      }
      const origUnregister = store.unregisterModule.bind(store)
      store.unregisterModule = (path) => {
        if (typeof path === 'string') path = [path]
        const key = path.join('/')
        const index = hook.storeModules.findIndex(m => m.path.join('/') === key)
        if (index !== -1) hook.storeModules.splice(0, 1)
        origUnregister(path)
      }
      hook.flushStoreModules = () => {
        store.registerModule = origRegister
        store.unregisterModule = origUnregister
        return hook.storeModules
      }
    } else {
      hook.flushStoreModules = () => []
    }     
  })

Can't detect my Vue component

This is my code:

import Vue from 'vue';
Vue.config.devtools = true;
Vue.config.performance = true;
import App from './App.vue';

new Vue ({
  el: '#main',
  render: h => h (App),
});

devtool is ok.

image

but performance pannel is not.

image

I am seeing no data: "No measures found"

This is how I have it setup and I am using typescript and my file is named app.ts. It is a fully working app and the Vue dev-tools work fine, just not seeing any performance data.

import Vue from 'vue';
import AppRoot from './AppRoot.vue';
import router from './Modules/Routing/RouterSetup';
import store from './Modules/Storage/VuexSetup';

Vue.config.devtools = true;
Vue.config.performance = true;

const app = new Vue({
  router,
  store,
  render: (h) => h(AppRoot),
}).$mount('#app');

export default {
  app,
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.