johnae / spook

Lightweight programmable evented utility based on LuaJIT and ljsyscall
Other
35 stars 0 forks source link

WIP: Cleanups #45

Closed johnae closed 7 years ago

johnae commented 7 years ago

Removes the Queue data structure thingie, which probably at some point seemed necessary or meaningful. It is replaced by a simple table only ever used as a kind of stack (at this time anyway). Works just fine for our purposes.

Changes the entr function used for finding common directories between files (for watching) given on command line. The new version is much easier to understand and possibly performs better though that is really beside the point (update: turns out I was completely wrong about performance - it was awful so this has been changed again).

This also adds a program failure with a descriptive error on Linux if the kernel refuses to add more inotify watches (can happen if you try to watch a very large amount of directories for example).

johnae commented 7 years ago

Actually, the second change (entr common dirs) is better for understanding but - as it turns out - absolutely horrible for performance. Indeed, it was built in a somewhat convoluted way to perform better when the input is a few hundred thousand files. I'm still convinced it can read alot better though.

Update: changed back to using something more similar to what was but hopefully more readable.