Best performance between reading from file and array

Hello all,
I have a question about performance and what is the better choice, I’m storing all my display text (like GUI texts and item names) in a xml file, my doubt is about what is better:

  • Load everything to a string array or dictionary when level starts
  • Read from file every time that it is required (each OnGUI for example) (the file is opened when level start and acessed every time it is needed)

I hope my doubt is clear, thanks in advance and sorry my bad english.

Preparing stuff in advance is almost always better.

The only way I see it not being better, is if you have a HUGE amount of data to load, which might cause a lag if you try to load it all at once.

If that is your case, you will need to make sure to only load what you need off the file (not the whole file) every time it’s needed.