Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase speed a thousand fold by caching
On my little laptop, the current script output rate is about 1.8 KBytes/s, which is nearly equal to the speed of the VT340's serial port (19.2 kbps). That is plenty fast for my VT340+ as the graphics processor is (probably) the bottleneck. However, the script could be made _much_ faster by caching the calculations in an array. [Here is a version](https://github.com/hackerb9/vt340test/blob/main/jerch/endless.sh) that increases the speed from 1.8 KBps to 1.8 MBps, as measured by `./endless.sh | pv -brat > /dev/null`. Code is included, but commented out, that would increase the speed to 88 MBps by caching into a string instead of an array. If desired, startup time could be shrunk. It takes about three seconds to create the cache during which the output rate is the same as before (1.8 KBps), but that be done more swiftly by moving the `for` loop within bc instead of forking bc 600 times.
- Loading branch information