This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse the repository at this point in the history
sysfs: improve SPI heap utilization and performance
- Put spiConn inside the SPI object instead of allocating it on the heap. - Create a 4 items array of spiIOCTransfer inside the SPI object to remove memory allocation when doing transfers of 4 items or less. This results in dramatic improvement when using spi.Conn.Tx(). Test environment: - go 1.10.2 - Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz - Raspberry Pi 3 Intel: 60% faster Before: BenchmarkSPI 10000000 167 ns/op 32 B/op 1 allocs/op After: BenchmarkSPI 20000000 68.0 ns/op 0 B/op 0 allocs/op RPi3: 37% faster Before: BenchmarkSPI 1000000 1795 ns/op 32 B/op 1 allocs/op After: BenchmarkSPI 1000000 1125 ns/op 0 B/op 0 allocs/op
- Loading branch information
Showing 1 changed file with 15 additions and 5 deletions.