1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Performance Question

Discussion in 'Development' started by iCirgio, Apr 20, 2019.

  1. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    Would it decrease the server performance to update a .json file every second?

    For example a timer for 20 minutes lowering every second until 0
     
  2. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    Yes
     
  3. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    That wouldn't really affect the perfomance of the server
    Anyway why don't you just make a global variable instead of updating it inside a .json
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Yes, reading/writing directly from/to disk is a heavy process and doing it that frequently is inefficient.
    Think of it like saving the world everytime a player sets or breaks a block.
     
    radondev, SOFe, dktapps and 1 other person like this.
  5. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    to clarify this ↑ : writing to disk is time-consuming.

    Also, beware that apparently small timescales (e.g. 10ms) are not really small. When you consider that a full server tick takes 50ms, taking 10ms per tick to write to disk is wasting 20% of your main thread time. (Disclaimer: the number 10ms is arbitrary and I pulled it out of my ass to make a point.)
     
    radondev, Diduhless and Muqsit like this.
  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.