Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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))
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
You can’t perform that action at this time.