Skip to content

Conversation

@TheBusyBiscuit
Copy link
Member

Description

This Pull Request introduces a bunch of optimizations for Servers using Paper.
Paper uses Asynchronous Chunk Generation/Loading which can improve performance for long-distance teleports.

BlockState Snapshots

Normally, Spigot creates a new BlockState instance as a hard copy, for InventoryHolders the Inventory is only copied softly, as a reference. Since Inventories are already Thread-safe and only the reference is passed, cargo networks have no reason to create a BlockState snapshot.
This behaviour cannot be avoided when using Spigot, with Paper it can.
So this will improve performance drastically (Sometimes up to 6 times smoother from what i tested) and optimize Cargo networks to work best when using Paper.

Changes

  • Added PaperLib as a shaded dependency
  • Added the "Works best with Paper" suggestion on startup
  • Optimized teleporter and elevators to use async-chunk-loading when possible
  • Huge optimizations for Cargo networks and multiblocks to not take BlockState snapshots when accessing inventories

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I added sufficient Unit Tests to cover my code.

WalshyDev
WalshyDev previously approved these changes Jul 20, 2020
Copy link
Member

@WalshyDev WalshyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. PaperLib is a nice thing to add. We should be making a paper tag on the server too when this PR is merged.

Copy link
Member

@WalshyDev WalshyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright.

@TheBusyBiscuit
Copy link
Member Author

Ready to be merged? @WalshyDev

I tested it on Spigot and Paper again, no issues thus far.

@TheBusyBiscuit TheBusyBiscuit merged commit a1952ed into master Jul 21, 2020
@TheBusyBiscuit TheBusyBiscuit deleted the paper branch July 21, 2020 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants