When building a Rust API backend, running two independent SQL queries sequentially caused noticeable UI lag. The solution was using rayon::join to run both queries in parallel with minimal boilerplate. Unlike parallel iterators, rayon::join accepts two closures of different types and handles thread management and synchronization transparently, resulting in clean, safe concurrent code without manual channel setup or thread joining.

3m read timeFrom cprimozic.net
Post cover image
Table of contents
Solution: rayon::joinThe Future with async/await

Sort: