Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Discussion Reducing Lag (Lobby)

Comments in 'General Discussion' started by Muqsit, Oct 22, 2015.

  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Oh, OK. I don't know then
  2. TheDiamondYT
    Offline

    TheDiamondYT New Member

    Joined:
    Dec 20, 2014
    Posts:
    44
    Minecraft User:
    TheDiamondYT7
    Th
    Then you have a ton of unheeded files which use space. The PocketMine phar is large enough, but the files are compressed into one. Having all those tons of files seperated isint a good idea.
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Well having one file is almost the same having one folder. Using the folder it's really easy to edit PocketMine code, instead of compressing new one each time you edit something. Compressed into .phar it does not make it lighter.
    Muqsit likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Compressing into a .phar makes the system seek the locations of different files first, so when the autoloader require_once's a file (and asks PHP to open that file), with a phar PHP can directly read from memory/already-sought disk positions while from source PHP has to ask the system to seek the file's position on the harddisk then open the file and read it, which is much slower.
    Moreover, note that, on Windows for example, each file actually takes at least 4 KB (or did I remember wrong?) even for files that are much smaller (not sure about other systems). This makes it take much more time to load a file.
    Given that PocketMine has more than 500 files in the src/ directory, that is equivalent to reading really much.

    Here is a dump of the list of files smaller than 4 KB:
    Actually, files larger than 4 KB take multiples of 4 KB for memory.
    And this dump shows how much extra memory has to be read on my system:
    Code:
    $ php -r '$x = 0;
    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(".")) as $file){ if($file->isFile()){
      $x += 4096 - (filesize($file) & 4095);
    }}
    print_r($x/1048576);'
    2.3918581008911
    
    That means if you load from source, you have to read 2.39MB extra data, while the whole project net size (not size on disk, but file size) is just 3.32MB.
    Muqsit and Primus like this.
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I cant believe that you're so bored :D Anyway thanks for
    Muqsit likes this.
  6. Muqsit
    Offline

    Muqsit Active Member

    Joined:
    Sep 9, 2015
    Posts:
    175
    Minecraft User:
    Muqsit
    Hope the thread isn't dead yet.
    So will using the src folder use up more RAM?
    Btw, I'm using an SSD and heard its way faster than an HDD in numerous ways.
    If I need the best performance, should I switch over to the .phar....or should I just keep using the src?

Share This Page

Advertisement