Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Created November 16, 2017 22:38
Show Gist options
  • Save yorickpeterse/ec9262060d4aaaff48e7304e8cc14034 to your computer and use it in GitHub Desktop.
Save yorickpeterse/ec9262060d4aaaff48e7304e8cc14034 to your computer and use it in GitHub Desktop.
#!/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