mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
Instead of always write-locking the plan maps first, read-lock them and check if the entry for the given size is present. If not, write-lock and insert it. That reduces contention on the map lock, allowing multiple threads to get an already created plan concurrently, without waiting on the write lock. Furthermore, use a (polynomial size, modulus) key for the NTT plan map, avoiding an issue where the user would get the incorrect plan if a different modulus is used for the same polynomial size.