2 ms·
How efficient is this in a multithreaded environment? Can immutable data be accessed from multiple threads without much cost?
by amelius 4y ago
How efficient is this in a multithreaded environment? Can immutable data be accessed from multiple threads without much cost?
- verdagon 4y agoSimilar to Rust, each thread would have separate memory. Data would be lent or passed to other threads via channels, mutexes, or structured concurrency.
- amelius 4y agoWhat if you have a large map that represents an in-memory read-only database, and you wish to share its contents between different threads, where each thread can perform complicated queries? Would you need to duplicate it?
- jollybean 4y agoI can't speak for the author, but it would seem to me that some kind of mutex or whatever can be used in situations were you need them.