add SMODS.deepfind and SMODS.deepfindbyindex#360
Conversation
this hopefully addresses the issue of nodes[1] chaining
|
tested with following commands:
eval SMODS.deepfind(_G, 6)[1].objtree
eval SMODS.deepfind(_G, 6)
eval SMODS.deepfind(_G, _G)
eval inspect(SMODS.deepfind(_G, _G)[1].tree)
eval inspect(SMODS.deepfind(_G, _G)[2].tree)
eval SMODS.deepfindbyindex(_G, "button")
eval inspect(SMODS.deepfindbyindex(_G, "button")[12].tree)
eval local t = love.timer.getTime() SMODS.deepfind(_G, "thisvaldoesntexist") print(love.timer.getTime() - t)
eval local t = love.timer.getTime() SMODS.deepfind(_G, true) print(love.timer.getTime() - t)
eval local t = love.timer.getTime() for i = 1, 10000 do SMODS.deepfind(G.GAME, "thisdoesntexist") end print(love.timer.getTime() - t)
eval local t = love.timer.getTime() for i = 1, 10000 do SMODS.deepfind(G.GAME, true) end print(love.timer.getTime() - t)
|
|
in conclusion everything works as expected. traversing the entire global space takes barely any time at all, and youll never need to do that anyways. it seems that care needs to be taken if the function is to be called a shit ton, but considering its main use is to be called once to find something (where the desired results can then be saved if you'll need it later) |
|
for above commit: |
|
why did cg223 try pulling the bottom out of a stack thinking it would be performant ? is he stupid ? |
|
should be done. im not at my computer, did that commit on my phone, so someone's gonna need to make sure the functions still work (which will be me around noon tomorrow assuming nobody else does it before then) |
|
okay for some reason after said finalizing, deepfind finds significantly fewer results |
|
nevermind. not sure what i was seeing. both old commit and latest commit got the exact same amount. so no issues. all those changes were just removing comments anyways lol. nothing couldve changed except for unrelated merges. anyways im not gonna touch this anymore |
|
Looks good to me |
this hopefully addresses the issue of nodes[1] chaining
see changes for more info