mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called. When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace. This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified. However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement. But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations. We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
This commit is contained in:
@ -26,6 +26,28 @@ namespace pocketmine\network\rcon;
|
||||
use pocketmine\snooze\SleeperNotifier;
|
||||
use pocketmine\Thread;
|
||||
use pocketmine\utils\Binary;
|
||||
use function count;
|
||||
use function ltrim;
|
||||
use function microtime;
|
||||
use function rtrim;
|
||||
use function socket_accept;
|
||||
use function socket_close;
|
||||
use function socket_getpeername;
|
||||
use function socket_last_error;
|
||||
use function socket_read;
|
||||
use function socket_select;
|
||||
use function socket_set_block;
|
||||
use function socket_set_option;
|
||||
use function socket_shutdown;
|
||||
use function socket_write;
|
||||
use function str_replace;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
use const PTHREADS_INHERIT_NONE;
|
||||
use const SO_KEEPALIVE;
|
||||
use const SO_LINGER;
|
||||
use const SOCKET_ECONNRESET;
|
||||
use const SOL_SOCKET;
|
||||
|
||||
class RCONInstance extends Thread{
|
||||
|
||||
|
Reference in New Issue
Block a user