monome / crow

Crow speaks and listens and remembers bits of text. A scriptable USB-CV-II machine
GNU General Public License v3.0
167 stars 34 forks source link

Increase maximum script size #386

Closed trentgill closed 3 years ago

trentgill commented 3 years ago

Currently limited to 8kB. This is somewhat of an arbitrary decision.

We have 64kB of Flash dedicated to script storage. It's unrealistic to have a script this large as it takes at least 1.5x the script length in RAM when loaded. And there's only ~55kB of accessible RAM available.

Even 10kB would be a substantial improvement, but 12kB would prob be good. 16kB would be overkill, but perhaps beneficial by making it so you don't have to even think about the limit.

First step is to make sure we don't have to allocate anything at the max size always. Perhaps we could require uploader to inform what the length is before sending the packet. Or maybe we can just piecemeal malloc buffer space in 2kB or 4kB chunks (unsure if the usb buffer is big enough to allow malloc time).

Second step is to make a giant script, perhaps with a big XkB string, and see what the impact on collectgarbage'count' is. We should set a limit so there is at least 32kB of working RAM available.

trentgill commented 3 years ago

fixed in #396