Git Product home page Git Product logo

vim-plugins-profile's Introduction

Build Status

TL;DR

# Perl version as an example:
perl <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.pl)

# or Ruby
ruby <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.rb)

# or Python (add -p flat to plot a bar chart)
python <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.py)

# or R
bash <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.sh)

Here is a screenshot to have a quick look at what this is all about.

My Plugins Profile

Here is a peek at the profiling result for my plugins:


Generating vim startup profile...
Parsing vim startup profile...
Crunching data and generating profile plot ...

Your plugins startup profile graph is saved
as `profile.png` under current directory.

==========================================
Top 10 Plugins That Slows Down Vim Startup
==========================================
   1	105.13	"vim-colorschemes"
   2	42.661	"vim-easytags"
   3	31.173	"vim-vendetta"
   4	22.02	"syntastic"
   5	13.362	"vim-online-thesaurus"
   6	7.888	"vim-easymotion"
   7	6.931	"vim-airline"
   8	6.608	"YankRing.vim"
   9	5.266	"nerdcommenter"
  10	5.017	"delimitMate"
==========================================
Done!

Story

If you use vim-plug (or other amazing plugin manager of your choice) to install your vim (gvim or macvim) plugins, then chances are high that it gets addictive. You will find yourself with several dozens of useful plugins.

vim-plug (and NeoBundle) offers you to load your plugins on-demand (lazy-loading). But which needs fine tuning? Well, using vim's built-in profiling vim --startuptime you can get a timing for all function calls during startup. However, the data is for each functions. You will have to figure out the math, and make sure those functions calls are form the same plugins. Even some sorting might help, but sorting the timing for each functions does not really make sense because it is really time of the plugins (but not the functions) that you really care about.

I am poor at doing mental math, even for simple sums. However, with the power of a simple bash script and R, we can get all we want.

This utility automatically detects your plugins directory, and does the rest of the hard work for you.

Supported Plugin-Managers

Here is the list of supported managers. Hopefully, your favourite plugin manager is among the list. If not, or if you prefer to manage your own plguins (using symlinks, of course), we could still adjust the code.

Installation

This is NOT a vim plugin! This is simply a profiler for your vim plugins that are installed through various plugin managers such as vim-plug.

Download the .zip here and then simply run the bash script:

bash ./vim-plugins-profile.sh  # calls R after pre-processing

# Use Perl powers! Built-in RegEx, no dependencies.
perl ./vim-plugins-profile.pl

# Or Python if you are from the other camp.
python ./vim-plugins-profile.py # -p flag plots a bar chart

# Alternatively use Ruby powers! Less dependency, graph with ASCII art
ruby ./vim-plugins-profile.rb

# To use an alternative executable such as neovim, pass it as the first argument.
ruby ./vim-plugins-profile.rb nvim

Then open the profile.png file for the result! It is that simple.

You can run it even without installation:

Dependency

Nothing. Well, at least Bash or Ruby or Perl or Python, but most systems already come with those pre-installed already.

If not (e.g. in M$ Windows systems), then you will need to install several tools before you can run this.

For the Perl Version:

  • Git for Windows: The Git Bash contains a minimal Perl installation which is sufficient to run vim-plugins-profile.pl.

For the Ruby Version:

  • Bash (Cygwin, or Git for Windows will also work).
  • Ruby 2.3 (other version might as well just work. If not, you can repurt an Issue then I'll fix it)

To produce the eye-candy graphs, you can use either R, Perl + GNUplot or Python.

For R, the script prompts whether it should install the R:ggplot2 package if you already have R. Here are the list of dependencies for it:

For Python, you can use either python2 or python3. If you have matplotlib (optional) installed, then you can even generate the bar plot. Implementation for people from the Python camp is merged from @bchretien. It also supports a custom command to run in the exec mode. Feel free to hack your way!

vim-plugins-profile's People

Contributors

deepanchor avatar dsiw avatar frenchja avatar gergap avatar grimreaper avatar hyiltiz avatar leonb avatar michaelmior avatar nedbat avatar rsrchboy avatar ryneeverett avatar saskiakeil avatar weakish avatar wfxr avatar yous 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  avatar  avatar  avatar  avatar  avatar  avatar

vim-plugins-profile's Issues

Fix travis.ci build fails

Probably due to something quite trivial. My hunch is it probably has something to do with sunsetting python2.

Type error in vim-plugins-profile.rb

Getting an error when running:

ruby vim-plugins-profile.rb

.

Testing nvim performance...
vim-plugins-profile.rb:11:in `join': no implicit conversion of nil into String (TypeError)
from vim-plugins-profile.rb:11:in `<main>'

Add dein support

Hi @hyiltiz,

This is a very useful tool. I use it a lot, since I have lots of plugins :(

Lately I wanted to try dein.vim. However, I could not profile it using your tool. I was wondering if you can support dein.vim too? The problem is dein.vim caches its files very differently from other plugin managers.

Thanks.

Object 'V4' not found

Hey there, nice script!

I tried running the shell script as per the instructions and nothing gets written to the results.csv file and the profile.png is empty.
I tried running through the R script line by line in the console, and after this line:

qplot(V4, V3, data = dat, stat = "summary", fun.y = "sum", geom = "bar") + coord_flip() + xlab("Installed Plugins") + ylab("Startup Time (ms)")

R outputs the following:

Error in eval(expr, envir, enclos) : object 'V4' not found

Any idea what could be wrong here? I've installed all the dependencies, but I'm not very familiar with R so it's likely I could be doing something wrong. Thanks!

add travis.ci

This would be very helpful to merging pull requests.

Support multiple pack/ dirs

I have my plugins separated in 3 pack/ directories: base/ for must-have plugins, langs/ for language-specific (mostly syntax files) and colorschemes/. The Python script reports only base/start without taking into account the other directories (which have more plugins, especially base/opt, but that one has all the lang-specific stuff I've been to lazy to move), while the rest fail.

Any idea how I can fix this? I'd really like to see the plotting features.

Doesn't show any plugins

When I run python <(curl -sSL https://raw.githubusercontent.com/hyiltiz/vim-plugins-profile/master/vim-plugins-profile.py)
I get only nvim as a plugin and there are no plugins in the list
image

Allow timing specific files

vim-plug supports on-demand loading, which means that if you just open a blank vim instance, you don't see the time spent to load the lazy plugin. It would be nice to allow timing opening various files, so you can see the difference.

Here's opening an empty file on my machine:

$ ruby vim-plugins-profile.rb
Testing vim performance...
Assuming your vimfiles folder is /home/joshua/.vim.
Generating vim startup profile...
vim-plug has been detected.

   vim-gitgutter: (2.919ms) ************************************************************************************************************************
    vim-fugitive: (2.073ms) *************************************************************************************
  vim-autoformat: (1.143ms) **********************************************
       ultisnips: (0.773ms) *******************************
editorconfig-vim: (0.642ms) **************************
     vim-markify: (0.637ms) **************************
  vim-paste-easy: (0.337ms) *************
            rust: (0.069ms) **
            bats: (0.052ms) **
    vim-snippets: (0.046ms) *
        vim-misc: (0.043ms) *
vim-markdown-toc: (0.029ms) *

And here's opening a rust file:

Testing vim performance...
Assuming your vimfiles folder is /home/joshua/.vim.
Generating vim startup profile...
vim-plug has been detected.

            rust: (26.353ms) ************************************************************************************************************************
   vim-gitgutter: (17.272ms) ******************************************************************************
    vim-fugitive: (7.404ms) *********************************
  vim-autoformat: (0.944ms) ****
editorconfig-vim: (0.71 ms) ***
       ultisnips: (0.596ms) **
     vim-markify: (0.453ms) **
  vim-paste-easy: (0.264ms) *
        vim-misc: (0.052ms) 
    vim-snippets: (0.042ms) 
            bats: (0.029ms) 
vim-markdown-toc: (0.024ms) 

Notice the factor of 10 slowdown.

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.