Commit Graph

2 Commits

Author SHA1 Message Date
Spottedleaf
05d074d557 Optimize DataWatcher
The lock in DataWatcher is used to prevent concurrent modifications
to the 'd' field (entries in MCP). However any modifications to
this map only occur on initialization of an Entity in its
constructor. This modification is write-locked.

Every other access is through a readlock, which allows
the threads to pass if there is no thread holding the
writelock.

Since the writelock is only obtained in the constructor
of the Entity, the further readlocks are actually
useless (which get obtained on set, get, etc calls).

The entries field ('d' currently) has also been declared as
Int2ObjectOpenHashMap to avoid autoboxing on put(), get(), etc
calls.
2019-05-13 20:37:18 -07:00
Spottedleaf
36873bf2d6 More 1.14 updates (#1995) 2019-04-26 23:05:36 -04:00