> python generate.py
> Rscript ggplot2.r
Generated graph will be saved to plot.png
import os, subprocess, random | |
from subprocess import PIPE, Popen | |
def cmd(command): | |
process = Popen(args=command, stdout=PIPE, stderr=subprocess.STDOUT, shell=True) | |
return process.communicate()[0].decode().strip() | |
def git(str): | |
return cmd(f"git -C 'gitsigns.nvim' {str}") | |
os.system("git clone https://github.com/lewis6991/gitsigns.nvim") | |
git("checkout main") | |
git("pull") | |
commits = int(git("rev-list --all --count")) # was non-linear for a while | |
f = open("data.csv", "w") | |
f.write('"time","speed","visual"\n') | |
for i in range(commits): | |
try: | |
speed = float(cmd(f"nvim --clean --headless -u min.lua")) | |
except: | |
speed = 0 | |
time = git("show -s --format=%cd --date=short") | |
visual = random.uniform(85, 100) | |
print(time, speed, visual) | |
if (speed > 0): | |
f.write(f"{time},{speed},{visual}\n") | |
git("checkout HEAD^1") | |
f.close() |
# Import required libraries | |
library(ggplot2) | |
# Set seed for reproducibility | |
set.seed(123) | |
data <- read.csv('data.csv') | |
data$time <- as.Date(data$time) | |
data <- data[order(data$time), ] | |
#Plot | |
p <- ggplot(data = data) + | |
geom_point(aes(x = time, y = speed, color = visual), size = 1.5) + | |
geom_smooth(aes(x = time, y = speed), color = "white", method = 'loess') + | |
scale_x_date(date_breaks = "5 month") + | |
scale_y_continuous(breaks = round(seq(0, 10, by = 1),1)) + | |
scale_color_gradient(low = "blue", high = "red") + | |
labs(title = "lewis6991/gitsigns.nvim setup speed over time", | |
x = "Time", | |
y = "Time (ms)", | |
color = 'visual (%)') + | |
theme( | |
# plot.margin=grid::unit(c(0,0,0,0), "cm"), | |
plot.background = element_rect(fill = "black"), | |
panel.background = element_rect(fill = "black"), | |
panel.grid.major = element_line(color = "#4c4c4c"), | |
panel.grid.minor = element_blank(), | |
plot.title = element_text(colour = "white", hjust = 0.5, face = "bold"), | |
axis.title.x = element_text(colour = "white"), | |
axis.title.y = element_text(colour = "white"), | |
axis.text.x = element_text(colour = "white"), | |
axis.text.y = element_text(colour = "white"), | |
legend.position="none", | |
legend.background = element_rect(fill = "black"), | |
legend.text = element_text(colour = "white"), | |
plot.subtitle = element_text(color = "white"), | |
plot.caption = element_text(color = "white") | |
) | |
# theme(aspect.ratio = 9 / 16) | |
ggsave("plot.png", plot = p, width = 10, height = 6, dpi = 300, bg = "black") |
vim.opt.rtp:append("plenary.nvim") | |
vim.opt.rtp:append("gitsigns.nvim") | |
local f = function() | |
require("gitsigns").setup{} | |
end | |
f() | |
local ok, _ = pcall(f) | |
if not ok then | |
local ok, _ = pcall(f) | |
if not ok then | |
print(0) | |
vim.cmd("0cq") | |
end | |
end | |
local sum = 0 | |
for i = 1, 100 do | |
for name, _ in pairs(package.loaded) do | |
if name:match "^gitsigns" then package.loaded[name] = nil end | |
end | |
local start = vim.loop.hrtime() | |
f() | |
sum = sum + (vim.loop.hrtime() - start) / 1000000 | |
end | |
print(sum / 100) | |
vim.cmd("0cq") |