GithubHelp home page GithubHelp logo

noscripter / startup_profile_vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomtom/startup_profile_vim

0.0 2.0 0.0 99 KB

Profile vim startup

Home Page: http://www.vim.org/scripts/script.php?script_id=2915

Vim Script 100.00%

startup_profile_vim's Introduction

With the introduction of the autoload directory, plugins were often 
split into several separate files. The downside is that it isn't always 
that obvious which files are actually loaded on startup.

You can use the :scriptnames command to get a list of files that were 
loaded during startup. This list tells you the order in which the files 
were loaded but it doesn't tell you much about the impact of that script 
on startup time. So what you actually want is a list of the scripts 
including certain indicators of how long it took to process a script.

From version 7.3 on, vim has a |--startuptime| command-line option that can be 
used to achieve something similar.

This macro creates a CSV file, which included the following information:

    * Number of the script
    * Filename
    * Number of line
    * Number of bytes
    * Timestamp
    * Approximate time it took to process the script (actually the time it 
      took until the next script was loaded)

You can open this (semicolon-separated) CSV in any spreadsheet 
application, sort the data etc.

The list can serve as a starting point for optimizing your startup time, 
for example by delaying certain calls to functions in autoload files or 
by making use of the AsNeeded plugin

In order to activate the macro, check the value of g:startup_profile_csv 
in the source code and temporarily insert the following line(s) at the 
beginning of your |vimrc| file: >

    " Setting g:startup_profile_csv is optional.
    let g:startup_profile_csv = "..."
    runtime macros/startup_profile.vim

The list can serve as a starting point for optimizing your startup time, 
e.g. by delaying certain calls to functions in autoload files or by 
making use of the AsNeeded plugin (vimscript #915).

Depending on your system configuration and the speed of your hard drive, 
seeking for files or, e.g., creating menu entries may prove to be costly 
with respect to startup time.

This script itself changes startup time because it accesses every script 
in order to find out its size and the number of lines.

This script logs all files until the |VimEnter| event is triggered. It 
is assumed that any files loaded thereafter are specific to the file 
being edited.

Related~

    * AsNeeded plugin: http://www.vim.org/scripts/script.php?script_id=915
    * Wiki page: http://vim.wikia.com/wiki/Optimize_startup_time_by_logging_the_sourced_vimscript_files



-----------------------------------------------------------------------

Status:  Works for me (there may be some minor quirks)
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.

startup_profile_vim's People

Contributors

tomtom avatar

Watchers

James Cloos avatar  avatar

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.