feat(performance): Major performance improvements using async v2 from @oberblastmeister (#987)
* start: Working w/ async jobs * short circuit to using bad finder if you pass writer.
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
local async_lib = require "plenary.async_lib"
|
||||
local async = async_lib.async
|
||||
local await = async_lib.await
|
||||
local void = async_lib.void
|
||||
local scheduler = require("plenary.async").util.scheduler
|
||||
|
||||
local make_entry = require "telescope.make_entry"
|
||||
|
||||
@@ -29,18 +26,18 @@ return function(opts)
|
||||
results = results,
|
||||
close = function() end,
|
||||
}, {
|
||||
__call = void(async(function(_, _, process_result, process_complete)
|
||||
__call = function(_, _, process_result, process_complete)
|
||||
for i, v in ipairs(results) do
|
||||
if process_result(v) then
|
||||
break
|
||||
end
|
||||
|
||||
if i % 1000 == 0 then
|
||||
await(async_lib.scheduler())
|
||||
scheduler()
|
||||
end
|
||||
end
|
||||
|
||||
process_complete()
|
||||
end)),
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user