Closed RishabhRD closed 3 years ago
We are also stopping idle_t when sorting is complete as the presence of idle_t is very CPU intensive.
However, if data is added or prompt text is changed, idle_t again starts. This makes it way more responsive than running idle_t all the time.
Previously single execution fuzzy engine used uv_timer to partition big sorting job for responsiveness in multiple iterations of the event loop. This not only made the fuzzy engine responsive for big jobs it made the fuzzy engine way faster than other pure lua competitors.
However, this also introduced a significant delay of 1ms between each job. That means if we have a fairly faster sorter, this would not utilize the CPU resources efficiently.
So, instead of having timer_t for partitioning sorting job into multiple iterations, this pull request partitions sorting job into multiple iterations using idle_t that runs in every iteration of the event loop after polling IO.