Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the concurrency of erts_fun_table insertions
While the erts_fun_table is protected by a read-write lock, when ensuring a fun, the runtime always acquires a writer lock allowing it to insert if the lookup fails. This has the undesirable effect of serializing the insertions even in the degenerate case where the fun is already present and the table does not need to be modified. This change uses a reader lock initially to offer more concurrency in the case where the fun is present, which can be a common case for applications that repeatedly transmit essentially the same fun objects between nodes. If the lookup fails, the code behaves as it did before and falls back to acquiring a writer lock and doing a lookup and insert as needed.
- Loading branch information