There is a certain table which gets over as follows:

for i = #someTable, 1, -1 do -- итераторы не используются для большей производительности local t = someTable[i] func1(ta, tb) func2(tc) if t.foobar then t.foobar() end func3(t) end 

I would like to speed up this process using Corutin (to sort through several threads). How to organize this process on Lua without third-party libraries? And are there any other ways to speed up the search?

  • one
    Coroutines (coroutine) are not streams. They are executed in the same thread, simply provide an opportunity to interrupt the execution of code in one function (coroutine) and switch to another function. And then go back to the same point. So on coroutines you will not get any acceleration. - zed
  • Is it possible to speed up this process somehow? - Vidoom
  • You can optimize the algorithm - to pass each iteration faster, or skip unnecessary iterations. What exactly do you highlight with each element? - Mira
  • Elements - tables. Several fields are taken from it and work with them separately. If the element has a function, then it is executed. Then the element is in any case passed to the next function, at this the iteration ends - Vidoom
  • @zed I know this, but in the book of R. Jeruzalimsky it is written that, in the case of a multiprocessor machine, the cortinas work parallel to the main thread - Vidoom

0