control profiling with NVIM_PROFILE env variable or F1 key

This commit is contained in:
Alexander Gehrke 2025-05-23 10:02:18 +02:00
parent e317dca789
commit 37309c0edd
6 changed files with 627 additions and 4 deletions

14
lua/profile/clock.lua Normal file
View file

@ -0,0 +1,14 @@
local hrtime = vim.loop.hrtime
local start = hrtime()
return setmetatable({
reset = function()
start = hrtime()
end,
}, {
__call = function()
-- Microseconds
return (hrtime() - start) / 1e3
end,
})