Commit Graph

1307 Commits

Author SHA1 Message Date
e67b1a20de Merge remote-tracking branch 'origin/release/3.4' 2018-11-17 14:47:35 +00:00
f8bfbc107d Reduce chunk memory usage by 20-60% by exploiting PHP copy-on-write behaviour (#2527)
This takes advantage of two key behaviours of PHP:
1. Assigning a string does not copy the string
2. Changing an offset in a string causes the string to be copied.

These two factors combined, along with the fact that blocklight and skylight arrays are usually all-zeros, allow us to produce a significant memory usage reduction of loaded chunks.
A freshly generated PM world with 3,332 chunks loaded drops from 310MB to 200MB memory usage with these changes applied.
2018-11-17 14:46:05 +00:00
8b9ec5dde3 Merge branch 'release/3.4' 2018-11-07 22:11:27 +00:00
a5f776af2f Merge branch 'release/3.3' into release/3.4 2018-11-07 22:11:13 +00:00
43fe6a1934 Merge branch 'release/3.2' into release/3.3 2018-11-07 20:02:28 +00:00
342a74ffcb Level: Collect garbage from chunk internals in doChunkGarbageCollection() 2018-11-07 20:01:07 +00:00
67a5f3f557 Register MainLogger as SPL global, remove hard MainLogger dependency from many areas, break a bunch of cyclic dependencies 2018-11-05 19:01:59 +00:00
38d419fb29 Level: use isInWorld() where appropriate 2018-11-04 12:59:34 +00:00
0e87cf801e Merge branch 'release/3.4' 2018-11-03 19:44:00 +00:00
af1227f154 Merge branch 'release/3.3' into release/3.4 2018-11-03 19:43:54 +00:00
d9a867016c Merge branch 'release/3.2' into release/3.3 2018-11-03 19:43:45 +00:00
a50a863ab7 Chunk: be more intelligent about fast-serializing chunks
This reduces the amount of useless data that pthreads has to copy around.
2018-11-03 19:43:35 +00:00
9caf62778c AsyncTask: remove $serialize parameter from setResult()
Whether serialization is necessary can be determined automatically based on the type of variable.
2018-11-03 16:56:24 +00:00
d257d36e55 Merge branch 'release/3.3' into release/3.4 2018-11-03 15:14:27 +00:00
1b03168b88 Merge branch 'release/3.2' into release/3.3 2018-11-03 15:12:40 +00:00
6b9fee05d6 Fixed performance bug with chunk sending
this process of fast-serialization, fast-deserialize, network-serialize is an order of magnitude slower than just doing the network encode directly on the main thread, and also copies more useless data.

For the main thread, the figures were something like 3x more expensive, and then an extra 7x for deserialization on the worker thread. This is a ridiculously large overhead.
2018-11-03 15:12:30 +00:00
a6c31b72ae Level: throw exceptions on bad positions in setBlock() 2018-10-28 16:42:16 +00:00
7607e484dd Expose chunk locking to the API 2018-10-28 16:32:56 +00:00
1e8b153662 Further cleanup to Simplex/Noise hierarchy 2018-10-28 16:30:18 +00:00
f4105fd91a Noise: remove a ton of dead code 2018-10-27 17:04:53 +01:00
ff28c982ac Kick out unnecessary Perlin class
the code in here isn't used anywhere except as a base for Simplex, so it makes more sense to flatten it and get rid of the crap.
2018-10-27 16:33:58 +01:00
a7eaec13b9 Merge branch 'release/3.4' 2018-10-24 15:53:13 +01:00
f61e099828 Merge branch 'release/3.3' into release/3.4 2018-10-24 15:52:04 +01:00
925da62afa Merge branch 'release/3.2' into release/3.3 2018-10-24 15:49:09 +01:00
09985c5763 Fixed async light population producing garbage when generator isn't registered, closes #2488 2018-10-24 15:49:00 +01:00
011b9ae159 Update to latest NBT lib version 2018-10-23 16:47:00 +01:00
a49abff099 Merge remote-tracking branch 'origin/release/3.4' 2018-10-22 17:46:37 +01:00
cac21c2caf SubChunk: implement branchless read/write for nibble arrays (#2489)
this was inspired by https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse/CraftBukkit-Patches/0121-Branchless-NibbleArray.patch
2018-10-22 17:46:14 +01:00
90482e79bc Merge branch 'release/3.4' 2018-10-21 18:23:54 +01:00
6dd2597934 Merge branch 'release/3.3' into release/3.4 2018-10-21 18:17:07 +01:00
5e68858ebf Merge branch 'release/3.2' into release/3.3 2018-10-21 18:16:59 +01:00
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
159c3a1a91 Merge branch 'release/3.4' 2018-10-20 19:20:22 +01:00
8ac1b18b17 Level: add API method isInLoadedTerrain() 2018-10-20 19:09:53 +01:00
fb128d0276 Merge branch 'release/3.4' 2018-10-20 16:43:25 +01:00
43426a4c5c Level: Add API method getViewersForPosition()
This returns all players who have the given position within their view radius.
2018-10-20 16:25:56 +01:00
9f8a2dc61a Make use of new API method getChunkAtPosition() 2018-10-20 15:58:29 +01:00
d9ebe6f321 Level: Added API method getChunkAtPosition()
This returns the chunk containing the given vector.
2018-10-20 15:54:13 +01:00
605e7e08ed Remove some deprecated methods 2018-10-20 15:29:43 +01:00
e035be8498 Remove some master-only usages of addGlobalPacket() 2018-10-20 15:27:08 +01:00
831a35ec69 Merge branch 'release/3.4' 2018-10-20 15:26:17 +01:00
cb1eb1ee09 Level: Rename addGlobalPacket() to broadcastGlobalPacket()
this name makes the intention more clear and consistent with other functions.
2018-10-20 15:24:33 +01:00
d563b9e31b Level: Added API method broadcastPacketToViewers()
This supersedes addChunkPacket() in most cases, and has a more clear name. It broadcasts the given packet to every player who has the target position within their chunk load radius.
2018-10-20 15:14:41 +01:00
517a21c418 RegionLoader: remove unused constant 2018-10-20 14:19:27 +01:00
d60c19551b Merge branch 'release/3.4' 2018-10-19 18:53:24 +01:00
7c44eea625 Merge branch 'release/3.3' into release/3.4 2018-10-19 18:53:18 +01:00
d749f19c73 Merge branch 'release/3.2' into release/3.3 2018-10-19 18:53:12 +01:00
41fd03f329 LightUpdate: fixed double-updated nodes not getting light propagated appropriately
This can happen when a light source is removed and later encountering another light source to fill the gap. A higher light level may get set and then not propagated. This bug is difficult to explain, but fairly easy to reproduce.
2018-10-19 18:53:04 +01:00
93b8a6c44a Level: fix light removal bugs caused by 48a5eeb3a4 and 19e68f98a7
BlockFactory::\$lightFilter and Block->getLightFilter() are not equivalent.
2018-10-19 18:52:42 +01:00
7642298b4f Merge branch 'release/3.4' 2018-10-19 15:56:07 +01:00