Using EEPROM.read vs using a global variable based on EEPROM.read

I am designing a process that allows users to change certain variables through an LCD and some push buttons. The values are then stored in EEPROM, and dictate how long things will run when certain actions happen.

I know there is a limit to EEPROM writes, but it appears that there is no limit to the number of times that an EEPROM can be read.

I am wondering if it is better to use EEPROM.read every time, or if it is better to create a global variable and set that off of the EEPROM.read, which would only happen at start-up and after a value is changed.

Here are the two examples:

Example 1:
{...
digitalWrite(pin, HIGH);
delay(EEPROM.read(address));
digitalWrite(pin, LOW);
...}

Example 2:
int delayTime;
void setup() {
delayTime = EEPROM.read(address);
}

void loop() {
...
digitalWrite(pin, HIGH);
delay(delayTime);
digitalWrite(pin, LOW);
...
}

I think example 1 is favorable bc it is simpler and avoids creating an extra variable, but I just wanted to check to see if there were any issues with that.

Cheers!

I am wondering if it is better to use EEPROM.read every time, or if it is better to create a global variable and set that off of the EEPROM.read,

There is no much in it.
However using EEPROM.read is slower than a normal variable.
That is about the only difference I can see.

Ok.

I am not dealing with anything that is time critical to the millisecond level, so I will just use the EEPROM.read.

Thanks!

Also, it would be easier to read your code if you would use the code tags (i.e., the '#' symbol) to surround your code. Also, while still in the IDE, place the cursor in the Source Code window and press Ctrl-T to format your code to the standard C style. I think you'll find readers more receptive if you do this.

Thanks for the tip!