Use $player->getId() instead $player->getName() as array index

Discussion in 'Requests' started by Akmal Fairuz, Oct 22, 2020.

  1. Akmal Fairuz

    Akmal Fairuz Creeper

    Messages:
    4
    GitHub:
    akmalfairuz
    We suggest to all developer plugins, use $player->getId() instead $player->getName() as array index / cache. That will make low memory usage and high performance.
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    474
    @everyone, follow the guidelines! ^
     
  3. mmm545

    mmm545 Baby Zombie

    Messages:
    102
    GitHub:
    mmm545
    :thinkies:
     
  4. minijaham

    minijaham Baby Zombie

    Messages:
    176
    GitHub:
    minijaham
    Didn't even know this existed. Thank you for bringing this up :d
     
  5. BeastBomber23

    BeastBomber23 Silverfish

    Messages:
    24
    GitHub:
    beastbomber23
    He is correct saying as each letter takes 5 bits and each number only takes 4 bits. Its not a drastic change but it will definetly help with performance if you have a mass amount of players on.
     
  6. mmm545

    mmm545 Baby Zombie

    Messages:
    102
    GitHub:
    mmm545
    i think you meant bytes, but yeah
     
  7. Primus

    Primus Zombie Pigman

    Messages:
    474
    Two rookie mistakes are using names as identifiers and not using Player::getDisplayName() as display name.
     
  8. BeastBomber23

    BeastBomber23 Silverfish

    Messages:
    24
    GitHub:
    beastbomber23
    Yeah i ment bytes lol
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.