diff options
author | Peter Odding <peter@peterodding.com> | 2011-06-14 06:43:24 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2011-06-14 06:43:24 +0200 |
commit | 9abe34873b1ea7c5fcc0bad20b311d85b04fc648 (patch) | |
tree | f92bb8e6e59a7e59162a31c9ff37207ba4cf077b /why-so-slow.py | |
parent | 980843ec662fa06990f3522999b2ad53e3cf625a (diff) | |
download | vim-easytags-9abe34873b1ea7c5fcc0bad20b311d85b04fc648.tar.gz |
2x faster syntax highlighting using Python Interface to Vim :-)
Diffstat (limited to 'why-so-slow.py')
-rwxr-xr-x | why-so-slow.py | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/why-so-slow.py b/why-so-slow.py deleted file mode 100755 index ead62f2..0000000 --- a/why-so-slow.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python - -''' -Determine which files are contributing the most to the size of a tags file. You -can specify the location of the tags file as a command line argument. If you -pass a numeric argument, no more than that many files will be reported. - -Author: Peter Odding <peter@peterodding.com> -Last Change: May 11, 2011 -URL: https://github.com/xolox/vim-easytags/blob/master/why-so-slow.py -''' - -import os, sys - -tagsfile = '~/.vimtags' -topfiles = 10 - -for arg in sys.argv[1:]: - if os.path.isfile(arg): - tagsfile = arg - else: - topfiles = int(arg) - -infile = open(os.path.expanduser(tagsfile)) -counters = {} - -for line in infile: - fields = line.split('\t') - filename = fields[1] - counters[filename] = counters.get(filename, 0) + len(line) -infile.close() - -sortedfiles = sorted([(s, n) for (n, s) in counters.iteritems()], reverse=True) -for filesize, filename in sortedfiles[:topfiles]: - if filename.startswith(os.environ['HOME']): - filename = filename.replace(os.environ['HOME'], '~') - print '%i KB - %s' % (filesize / 1024, filename) - -# vim: ts=2 sw=2 et |