monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
621 stars 144 forks source link

menu file SELECT bogs lua timing #815

Closed tehn closed 4 years ago

tehn commented 5 years ago

the script list folder recursion is too heavy for lua to maintain timing of metros/etc, so it's likely that metros will get stalled and a running script will stutter. (ie awake)

more pronounced with more scripts in the folder.

coroutines is one solution.

okyeron commented 5 years ago

There may also be other/faster ways to get/parse the directory structure without recursively hammering scandir/popen

I looked at this briefly awhile back and will revisit

audionerd commented 5 years ago

In build_select_tree , how about a single popen to find . -type f -name "*.lua" and then filter that list?

tehn commented 5 years ago

that would certainly accelerate the process if you want to give it a try. i won't be able to get to this for a bit.

audionerd commented 5 years ago

i gave it a try:

https://github.com/audionerd/norns/commit/faa4b1c8da04f03f2cd6ac9aded244e0626fcd00#diff-43ab06b2651c491ba3ef9004fa809bd1

but i still notice a lag in metros & dropped MIDI clock messages on SELECT :/

tehn commented 5 years ago

likely needs https://github.com/monome/norns/issues/779

catfact commented 4 years ago

i'm trying to see how a coroutine could help this. i will make some relevant comments on 779.

the only actual solution i see is to create an asynchronous wrapper for these blocking OS calls, in C, backed by pthreads. coroutines could rovide some convenient syntax on the lua side.

catfact commented 4 years ago

i'd actually recommend closing this and making #779 more specific ("implement asynchronous system calls")

tehn commented 4 years ago

agreed!