• Stars
    star
    251
  • Rank 161,076 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“Š Utility script to profile (n)vim (e.g. startup times of plugins)

vim-profiler

Build Status

Utility script to profile (n)vim (e.g. startup). For now, only startup time w.r.t. plugins is analyzed. The plugin directory is automatically found.

The script is inspired from vim-plugins-profile, but only depends on Python. It supports the following features:

  • run any vim/neovim command,
  • detect the plugin directory automatically,
  • handle GUI versions,
  • compute the average time/standard deviation over multiple runs,
  • export the result to a CSV file,
  • plot a bar chart.

Dependencies

Required:

  • Python 2 or Python 3,
  • vim or neovim.

Optional:

  • Matplotlib (for bar plot)

Usage

To list the available options:

$ vim-profiler.py -h
usage: vim-profiler.py [-h] [-o CSV] [-p] [-s] [-n N] [-r RUNS] ...

Analyze startup times of vim/neovim plugins.

positional arguments:
  cmd         vim/neovim executable or command

optional arguments:
  -h, --help  show this help message and exit
  -o CSV      Export result to a csv file
  -p          Plot result as a bar chart
  -s          Consider system plugins as well (marked with *)
  -n N        Number of plugins to list in the summary
  -r RUNS     Number of runs (for average/standard deviation)

The text summary looks like this:

$ vim-profiler.py nvim

Running nvim to generate startup logs... done.
Loading and processing logs... done.
Plugin directory: /home/user/.config/nvim/plugged
=====================================
Top 10 plugins slowing nvim's startup
=====================================
1         4.559   vim-fugitive
2         4.162   tcomment_vim
3         3.936   vim-hybrid
4         2.922   lightline.vim
5         1.551   supertab
6         1.522   vim-sneak
7         1.100   ultisnips
8         0.929   fzf.vim
9         0.916   fzf
10        0.877   vim-surround
=====================================

As for the plot (using Matplotlib):

$ vim-profiler.py -p -r 10 nvim
=====================================
Top 10 plugins slowing nvim's startup
=====================================
1         3.326   vim-fugitive
2         2.936   tcomment_vim
3         2.315   vim-hybrid
4         1.751   lightline.vim
5         0.959   vim-sneak
6         0.943   supertab
7         0.542   vim-surround
8         0.536   fzf.vim
9         0.450   fzf
10        0.434   auto-pairs
=====================================

plot

You can also use a custom command. Simply write it after the other options:

$ vim-profiler.py vim -u NONE

Running vim to generate startup logs... done.
Loading and processing logs...
No plugin found. Exiting.

This is particularly useful if you want to test your plugin manager's lazy loading feature:

$ vim-profiler.py -n 5 nvim foo.cc

Running nvim to generate startup logs... done.
Loading and processing logs... done.
Plugin directory: /home/user/.config/nvim/plugged
====================================
Top 5 plugins slowing nvim's startup
====================================
1         5.613   vim-cpp-enhanced-highlight
2         3.457   vim-fugitive
3         2.864   tcomment_vim
4         2.389   vim-hybrid
5         1.870   lightline.vim
====================================

$ vim-profiler.py -n 5 nvim foo.cc -c ":exec ':normal ia' | :q\!"

Running nvim to generate startup logs... done.
Loading and processing logs... done.
Plugin directory: /home/user/.config/nvim/plugged
====================================
Top 5 plugins slowing nvim's startup
====================================
1       144.766   ultisnips
2        95.977   YouCompleteMe
3        11.408   vim-cpp-enhanced-highlight
4         3.463   vim-fugitive
5         2.992   tcomment_vim
====================================

Here ultisnips and YouCompleteMe were only loaded after entering insert mode.

License

GPLv3

More Repositories

1

AlienFxLite

๐Ÿ‘ฝ A keyboard color management tool for Alienware laptops (written in Java with a C++ native library).
Java
68
star
2

arch-ros-stacks

๐Ÿ“ฆ AUR packages of ROS stacks.
Shell
46
star
3

tcptrack

๐Ÿ” Backup of Steve Benson's tcptrack, a sniffer which displays information about TCP connections it sees on a network interface.
C++
45
star
4

BlackPearlConky

Black Pearl Conky theme by Ninquitassar (http://ninquitassar.deviantart.com/art/Black-Pearl-Conky-281468275)
Lua
25
star
5

rust-ncmpc

ncmpcpp clone written in Rust
Rust
10
star
6

i3-config

Configuration files for i3 and i3bar
Shell
7
star
7

cmake-cuda-static

Quick & dirty CMake tests for static device library support.
Cuda
5
star
8

AlienFX-LED-tester

LED tester for Alienware's AlienFX devices. Based on Ingrater's work: http://3d.benjamin-thaut.de/
C++
5
star
9

metis4

METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices (patched version with CMake support)
C
4
star
10

dotfiles

Configuration files and utilities for my Linux system.
Vim Script
4
star
11

iRRT

A simulator for Rapidly-Exploring Random Tree (RRT) algorithm from Correll Lab.
Java
4
star
12

sddm-futuristic-theme

A futuristic theme for SDDM.
2
star
13

cddplus

GitHub fork of Komei Fukuda's cdd+: http://www.inf.ethz.ch/personal/fukudak/cdd_home/
C
2
star
14

shell-sandbox

A sandbox for shell scripting development
Shell
2
star
15

PKGBUILD

A list of PKGBUILDs I maintain or contribute to for Arch Linux (AUR).
Shell
2
star
16

conky-themes

Multiple conky themes to be used in my dotfiles
Lua
1
star