Save variables or read from file?

Discussion in 'Plugin Development' started by Malikk, Mar 24, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Malikk

    Hey guys,

    I'm wondering about the pros and cons of these 2 systems. I've got maybe 200 integers that need to be read in from a config file. What do you guys think about reading them all in onEnable and storing them all, versus reading them from the file a bunch of times whenever I need them?

    Thanks.
     
  2. Offline

    Tirelessly

    Store them all onEnable.
     
  3. Offline

    Malikk

    Would you mind elaborating as to why?

    I'm basically trying to decide if it's better to keep a lot of things in memory, or access a file a lot of times, and based on my limited knowledge, they both seem bad for different reason. Specifics would help me out.
     
  4. Offline

    Tirelessly

    Well one integer takes up a total of four bytes.. Don't be too concerned. Unless you only check the yml once, then storing it is going to use up less memory.
     
    Malikk likes this.
  5. Offline

    Malikk

    Sweet. Thanks
     
Thread Status:
Not open for further replies.

Share This Page