Skip to content

Commit 0f0d5bc

Browse files
committed
further optimize stack monitoring
10-15x speedup by skipping ignoring source path resolution in stack monitoring.
1 parent 6837c6c commit 0f0d5bc

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

lua/osv/init.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ function M.attach()
519519
local inside_osv = false
520520
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
521521
local source = info.source:sub(2)
522-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
523-
local parent = vim.fs.dirname(path)
522+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
523+
local parent = vim.fs.dirname(source)
524524
if parent and vim.fs.basename(parent) == "osv" then
525525
inside_osv = true
526526
end
@@ -719,8 +719,8 @@ function M.attach()
719719
local inside_osv = false
720720
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
721721
local source = info.source:sub(2)
722-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
723-
local parent = vim.fs.dirname(path)
722+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
723+
local parent = vim.fs.dirname(source)
724724
if parent and vim.fs.basename(parent) == "osv" then
725725
inside_osv = true
726726
end
@@ -810,8 +810,8 @@ function M.attach()
810810
local inside_osv = false
811811
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
812812
local source = info.source:sub(2)
813-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
814-
local parent = vim.fs.dirname(path)
813+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
814+
local parent = vim.fs.dirname(source)
815815
if parent and vim.fs.basename(parent) == "osv" then
816816
inside_osv = true
817817
end
@@ -965,8 +965,8 @@ function M.attach()
965965
local inside_osv = false
966966
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
967967
local source = info.source:sub(2)
968-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
969-
local parent = vim.fs.dirname(path)
968+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
969+
local parent = vim.fs.dirname(source)
970970
if parent and vim.fs.basename(parent) == "osv" then
971971
inside_osv = true
972972
end
@@ -999,8 +999,8 @@ function M.attach()
999999
local inside_osv = false
10001000
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
10011001
local source = info.source:sub(2)
1002-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1003-
local parent = vim.fs.dirname(path)
1002+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1003+
local parent = vim.fs.dirname(source)
10041004
if parent and vim.fs.basename(parent) == "osv" then
10051005
inside_osv = true
10061006
end
@@ -1262,8 +1262,8 @@ function M.attach()
12621262
local inside_osv = false
12631263
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
12641264
local source = info.source:sub(2)
1265-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1266-
local parent = vim.fs.dirname(path)
1265+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1266+
local parent = vim.fs.dirname(source)
12671267
if parent and vim.fs.basename(parent) == "osv" then
12681268
inside_osv = true
12691269
end
@@ -1725,8 +1725,8 @@ function M.start_trace()
17251725
local inside_osv = false
17261726
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
17271727
local source = info.source:sub(2)
1728-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1729-
local parent = vim.fs.dirname(path)
1728+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
1729+
local parent = vim.fs.dirname(source)
17301730
if parent and vim.fs.basename(parent) == "osv" then
17311731
inside_osv = true
17321732
end

src/handlers/stack_trace.lua.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ end
9191
@check_if_inside_osv+=
9292
if info.source:sub(1, 1) == '@' and #info.source > 8 and info.source:sub(#info.source-8+1,#info.source) == "init.lua" then
9393
local source = info.source:sub(2)
94-
local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
95-
local parent = vim.fs.dirname(path)
94+
-- local path = vim.fn.resolve(vim.fn.fnamemodify(source, ":p"))
95+
local parent = vim.fs.dirname(source)
9696
if parent and vim.fs.basename(parent) == "osv" then
9797
inside_osv = true
9898
end

0 commit comments

Comments
 (0)