What is the idiomatic way to insert into a shared set?

File IO is not really possible without blocking IO in any case, so async does not gain you much. For this reason, reading the files synchronously in a spawn_blocking call is a fine way to do it. As for the ram disk, it will speed up either approach simply because ram disks allow faster access to the file.

@cuviper As I understood the purpose, the set is created once and then used, in which case I would not recommend a concurrent set. To be fair, this assessment was aided by having also answered this thread.

1 Like