Many thanks - this was a great help, and worked fine on my RUT-240. The flash usage went up to 34% (from 7%?) and RAM usage may have increased slightly, but otherwise all fine.
A sample output for those interested below - Claro 4G LTE connection in rural Brazil:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
root@Teltonika-RUT240:/usr/lib/OpenWrtScripts# sh betterspeedtest.sh
2019-08-16 17:05:35 Testing against netperf.bufferbloat.net (ipv4) with 5 simultaneous sessions while pinging gstatic.com (60 seconds in each direction)
...............................................................
Download: 12.53 Mbps
Latency: (in msec, 64 pings, 0.00% packet loss)
Min: 38.617
10pct: 41.641
Median: 52.484
Avg: 55.865
90pct: 68.792
Max: 131.557
.............................................................
Upload: 11.23 Mbps
Latency: (in msec, 62 pings, 0.00% packet loss)
Min: 35.227
10pct: 268.011
Median: 723.002
Avg: 747.118
90pct: 1179.869
Max: 1663.480
root@Teltonika-RUT240:/usr/lib/OpenWrtScripts#