Commit Graph

1 Commits

Author SHA1 Message Date
Aikar
0d1ca37436
Remove MOST Synchronization from Chunk Map
This will provide quite a major performance boost by avoiding
synchronizing on EVERY chunk lookup.

Synchronize, even without contention, incurs processor cache flushes.

Considering this is the 2nd hottest method in the code base, lets
avoid doing that...

Additionally, chunk conversion operations were occuring while
under synchronization which lead to deadlocks.

Now the conversion will occur outside of the lock, and fix
that issue, resolving #1586

Note, that the chunk map is still thread safe for get operations!

The chunk map was never intended to be modified async with our
changes, as we post to main to modify the map, however
we do still synchronize for write operations (put, remove)

We also synchronize for async get operations, ensuring that
async gets are safe.

We do not need to synchronize main thread gets as the processor
cache will be insync since the map is only updated on the main thread.

However, if someone does try to delete or put concurrently, we
will force their operation back to the main thread.
2018-10-18 22:41:23 -04:00