Performance
An open driver can be profiled and improved by anyone. The first round of that work has made OpenRSP's service cheaper to run than the proprietary one, without changing a single output sample.
CPU use of the service
Measured on Linux x86-64 with a real RSP1B, as CPU time used by the service during 10 seconds of steady streaming (lower is better):
| Sample rate | Proprietary service | OpenRSP, before | OpenRSP, now | Change |
|---|---|---|---|---|
| 2 MS/s | 587 ms | 684 ms | 537 ms | 21% less than before; about 9% less than the proprietary service |
| 10 MS/s | 1,488 ms | 1,442 ms | about 1,205 ms | 16% less than before; about 19% less than the proprietary service |
Where the savings came from:
- Zero-copy USB buffers. Stream transfers now go into memory mapped directly from the kernel's USB layer on Linux and Android, so the kernel no longer copies every packet into user space.
- No more shuffling of the packet queue. The service used to move the remaining packets to the front of its queue after every block, up to 380 KB at a time. It now advances a read position instead.
- Fewer clock reads and lock set-ups on the uncontended fast path.
Bit-exact, always
Every optimisation must leave the output unchanged. The sample stream, gain values and AGC decisions are checked against the proprietary driver's output and must match bit for bit. The SIMD kernels (AVX2 and AVX-512 on x86, NEON on ARM) are chosen at run time from the CPU's features, and each one gives exactly the same result as the plain C++ code.
Some faster approaches that changed the output slightly were tried and deliberately not adopted.
Phones and tablets
- Android: gap-free streaming at 8 MS/s on a Pixel 8a. The driver's own stream thread uses about half of one CPU core at that rate.
- iPadOS: gap-free streaming at 8 MS/s isochronous on an iPad Air (M4).
What is next
The largest remaining cost is the DC-offset filter, a long serial calculation that has to stay bit-exact. Hand-written vector versions for x86 and ARM could make it up to three times faster. Profiles, patches and measurements from other hardware are welcome.