40 Commits

Author SHA1 Message Date
Dylan K. Taylor
4b9a142a5d 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.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
3725bea3e5 AsyncPool: Slightly reduce worker memory usage with more conservative start options
this results in a memory footprint reduction of maybe 4MB for a total of 8 workers. Not much, but it's something.
2018-06-10 10:18:07 +01:00
Dylan K. Taylor
b331f8e1c9 AsyncWorker: added removeFromThreadStore()
and use it instead of overwriting with null things, which still occupies memory
2018-06-07 10:12:50 +01:00
Dylan K. Taylor
ee787974f2 AsyncWorker: Use statics for thread-local worker storage instead of globals 2018-06-07 09:59:32 +01:00
Dylan K. Taylor
1d71f0cf43 AsyncWorker: added getLogger() 2018-06-04 13:29:38 +01:00
Dylan K. Taylor
1b4723d816 AsyncWorker: don't require an attachable logger 2018-05-31 10:34:42 +01:00
Dylan K. Taylor
6ceb9af749 .-. 2018-05-10 12:51:39 +01:00
Dylan K. Taylor
bcd197d7bb AsyncWorker: fixed __construct() signature 2018-05-10 12:50:09 +01:00
Dylan K. Taylor
3148f692c1 AsyncWorker: No need to register static logger - it's inherited by default with pthreads 3.1.7 2018-05-10 12:49:03 +01:00
Dylan K. Taylor
7ba193dc2e Set ErrorException handler on AsyncWorkers 2017-09-28 18:01:31 +01:00
Dylan K. Taylor
15b08c1417 Added capability to dump AsyncWorkers' memory (#1379)
This now actually works with PHP 7.2 + latest pthreads, before it was too unstable.
2017-09-14 16:45:48 +01:00
Dylan K. Taylor
d1852834de Revert "Added capability to dump AsyncWorker memory"
This reverts commit eb4594348b6fe4f8af83d5fd386f393956f7b561.

This is far too unstable with more than one worker thread.
2017-08-22 20:46:20 +01:00
Dylan K. Taylor
eb4594348b Added capability to dump AsyncWorker memory 2017-08-22 19:57:00 +01:00
Dylan K. Taylor
17053389b0 Added memory limits for AsyncWorkers 2017-08-20 12:15:48 +01:00
Dylan K. Taylor
2018ad6376 Merge master 2017-07-14 12:12:35 +01:00
Dylan K. Taylor
b5790d19bf Cleaned up MainLogger registration and declared a typehint
Remove null hint from MainLogger::getLogger() so static analysis doesn't complain everywhere
just make sure you register the logger before trying to use MainLogger::getLogger() on a different thread!
2017-07-14 11:39:04 +01:00
Dylan K. Taylor
8fc1501e89 Moar typehints 2017-07-14 08:52:27 +01:00
Dylan K. Taylor
9c9095060f Register MainLogger on AsyncWorkers to make MainLogger::getLogger() usable in AsyncTasks
Threaded static properties aren't thread-local anymore in pthreads 3.1.7dev
2017-07-04 16:50:17 +01:00
Dylan K. Taylor
481114281e Server starts! 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Shoghi Cervantes
0bcf639a98 Changed how exceptions work and are logged, throw proper exceptions on tasks 2015-09-18 12:03:24 +02:00
Shoghi Cervantes
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
Shoghi Cervantes
7cf5df7e46 New console output formatting 2015-06-09 14:40:40 +02:00
Shoghi Cervantes
b2c25eaf36
Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs 2015-04-18 20:13:52 +02:00
Shoghi Cervantes
88797d4c6c
Enabled GC on AsyncWorker 2015-04-15 20:47:34 +02:00
Shoghi Cervantes
71657a2a4e Improved effects, threading changes 2015-04-08 17:31:06 +02:00
Shoghi Cervantes
72c4c01542 Yay generation uses async tasks 2015-03-26 18:21:39 +01:00
Shoghi Cervantes
11c13cd666
Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:13 +01:00
Shoghi Cervantes
692045d714
Improved threading and resource usage, new defaults 2015-01-02 18:46:39 +01:00
Shoghi Cervantes
f4ae58dda2 Removed pthreads workarounds 2014-09-10 15:11:56 +02:00
Shoghi Cervantes
f4b92bcdfc Fixed #1980 2014-08-27 11:41:00 +02:00
Shoghi Cervantes
bda597a71e Moved spl to PocketMine-SPL 2014-08-25 20:54:53 +02:00
Shoghi Cervantes
77799d8f3d Fixed AsyncWorker includes 2014-08-08 18:06:07 +02:00
Shoghi Cervantes
eff454d103 Fixed AsyncWorker not getting the proper path and not using the correct class 2014-08-08 11:51:36 +02:00
Shoghi Cervantes
51120fdd4f Added ThreadManager, removed PHP self-kill 2014-08-08 11:36:55 +02:00
Shoghi Cervantes
bf49cafeae Added settings.async-workers to tune the amount of AsyncTask workers 2014-06-22 12:55:08 +02:00
Shoghi Cervantes
7f795bc041 Fixed #1501 executing AsyncTasks blocks other threads 2014-06-22 12:50:24 +02:00
Shoghi Cervantes
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00
Shoghi Cervantes
80f9093875 Added /reload command (does not reload source code) 2014-04-03 15:49:00 +02:00