Created
November 16, 2017 22:38
-
-
Save yorickpeterse/ec9262060d4aaaff48e7304e8cc14034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import neovim | |
import time | |
import re | |
import subprocess | |
def memory_of(pid): | |
file = open('/proc/{}/status'.format(pid), 'r') | |
mem = re.search('VmRSS:\s+(\d+)', file.read()) | |
return int(mem.group(1)) / 1024.0 | |
pid = int(subprocess.check_output(['pidof', 'gnome-terminal-server'])) | |
start_mem = memory_of(pid) | |
nvim = neovim.attach('tcp', address='127.0.0.1', port='9999') | |
nvim.command('edit $VIMRUNTIME/syntax/ruby.vim') | |
nvim.command('set foldlevel=20') | |
nvim.command('100') | |
nvim.command('vnew $VIMRUNTIME/syntax/css.vim') | |
nvim.command('set foldlevel=20') | |
nvim.command('300') | |
nvim.command('tabnew $VIMRUNTIME/syntax/python.vim') | |
nvim.command('set foldlevel=20') | |
nvim.command('300') | |
for i in range(100): | |
nvim.command('tabnext') | |
time.sleep(0.2) | |
nvim.quit() | |
mem_increase = memory_of(pid) - start_mem | |
print("Memory start: {} MB".format(start_mem)) | |
print("Memory increase: {} MB".format(mem_increase)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set number | |
set termguicolors | |
syntax on | |
color desert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment