Skip to content

Commit

Permalink
Reorder operations in hookWorld to account for introduced overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
Nidoxs committed Aug 13, 2024
1 parent b165f82 commit 818b90b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/debugger/hookWorld.luau
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ local function hookWorld(debugger)
for _ in originalQuery(world, ...) do
end

local duration = os.clock() - start
local file, line = debug.info(2, "sl")

local key = file .. line
Expand All @@ -29,15 +28,16 @@ local function hookWorld(debugger)
samples[key] = sample
end

rollingAverage.addSample(sample, duration)

local averageDuration = rollingAverage.getAverage(debugger._queryDurationSamples[file .. line])

local componentNames = {}
for i = 1, select("#", ...) do
table.insert(componentNames, tostring((select(i, ...))))
end

local duration = os.clock() - start
rollingAverage.addSample(sample, duration)

local averageDuration = rollingAverage.getAverage(debugger._queryDurationSamples[file .. line])

table.insert(debugger._queries, {
averageDuration = averageDuration,
componentNames = componentNames,
Expand Down

0 comments on commit 818b90b

Please sign in to comment.