Skip to content

Large move operations have slowed down - blame the API? #169

@planetguy32

Description

@planetguy32

As it stands, massive structures can take quite some time to move. I suspect this may be because we allocate and post around 10 new event objects per position to move. Each handler also has to check if the block it's dealing with is an instanceof the right type. Off the top of my head I can think of these options:

  • Stay the course: This would leave large moves still slow, but wouldn't break API.
  • Cache event objects: This would save us the GC pressure, but there's a chance it could break API users that store our event objects after their handlers exit.
  • Make an interface for blocks to implement, use (Mixin)[https://github.com/SpongePowered/Mixin] to apply our patches: This would get rid of both the allocations and the instanceof checks, but compatibility with the current API would be nigh impossible.

I'm leaning towards the second option myself since instanceof() should be fast on modern JVMs and it saves both us and API users a bunch of work, but I think the third might merit further investigation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions