From a97af306c4e9c9a6fa7c886c0ffe3079822c5203 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 20 Aug 2021 11:11:24 -0400 Subject: 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. --- lua/telescope/entry_manager.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lua/telescope/entry_manager.lua') diff --git a/lua/telescope/entry_manager.lua b/lua/telescope/entry_manager.lua index ff8b9ba..5055171 100644 --- a/lua/telescope/entry_manager.lua +++ b/lua/telescope/entry_manager.lua @@ -155,7 +155,10 @@ function EntryManager:add_entry(picker, score, entry) info.looped = info.looped + 1 if container[2] > score then - -- print("Inserting: ", picker, index, node, new_container) + return self:_insert_container_before(picker, index, node, new_container) + end + + if score < 1 and container[2] == score and #entry.ordinal < #container[1].ordinal then return self:_insert_container_before(picker, index, node, new_container) end @@ -174,11 +177,13 @@ function EntryManager:add_entry(picker, score, entry) end function EntryManager:iter() - return coroutine.wrap(function() - for val in self.linked_states:iter() do - coroutine.yield(val[1]) + local iterator = self.linked_states:iter() + return function() + local val = iterator() + if val then + return val[1] end - end) + end end return EntryManager -- cgit v1.2.3