-
Notifications
You must be signed in to change notification settings - Fork 18
`getHeight` and `getBlock` performance impacts
You may notice when using the library that code running getHeight
or getBlock
in a loop is not very performant. This is an unfortunate limitation of how the communication between your code and Minecraft works - the socket over which information is sent is blocked while it waits for a response. Speeding this up requires being at least somewhat hacky - it's not possible to multithread or async these calls without propagating to client code. Unfortunately, this project is meant as a teaching tool, which means that the end users should not be forced to use C++ async code.
Fortunately, there is an easy way to work around this - call the bulk equivalents of getHeights
and getBlocks
! You can access the results in a data structure stored in local memory that does not have any socket overheads. This will probably make your code run almost instantaneously in comparison to the results you had before.