user38968: Do I understand the code in EEPROM.cpp / write() correctly, that val is only written to the EEPROM, if val differs from the current EEPROM contents at the given address?
And if the answer is yes, what is commit() doing?

user42354: I read that after the EEPROM.commit() you need to add a delay(500).
I had several issues with the EEPROM data gone after several restarts
of the esp8266. 

user31105: From library Library, see fragment:

EEPROM.write does not write to flash immediately, instead you must
  call EEPROM.commit() whenever you wish to save changes to flash.
  EEPROM.end() will also commit, and will release the RAM copy of EEPROM
  contents.

Probably to prevent too many writes into the same page (mostly EEPROM is divided in pages), the write stores it into some temporary buffer and the commit actually writes it to EEPROM. This decreases the number of writes, and since the number of writes has a maximum, the lifetime of the EEPROM is increased.
Update: Majenko's comment mentions no EEPROM is used, but flash, see below.

38968: <p>Do I understand the code in <code>EEPROM.cpp / write()</code> correctly, that <code>val</code> is only written to the EEPROM, if <code>val</code> differs from the current EEPROM contents at the given <code>address</code>?</p>

<p>And if the answer is <em>yes</em>, what is <code>commit()</code> doing?</p>
 42354: <p>I read that after the EEPROM.commit() you need to add a delay(500).
I had several issues with the EEPROM data gone after several restarts
of the esp8266. </p>
 31105: <p>From library <a href="http://esp8266.github.io/Arduino/versions/2.0.0/doc/libraries.html" rel="nofollow noreferrer">Library</a>, see fragment:</p>

<blockquote>
  <p>EEPROM.write does not write to flash immediately, instead you must
  call EEPROM.commit() whenever you wish to save changes to flash.
  EEPROM.end() will also commit, and will release the RAM copy of EEPROM
  contents.</p>
</blockquote>

<p>Probably to prevent too many writes into the same page (mostly EEPROM is divided in pages), the write stores it into some temporary buffer and the commit actually writes it to EEPROM. This decreases the number of writes, and since the number of writes has a maximum, the lifetime of the EEPROM is increased.</p>

<p>Update: Majenko's comment mentions no EEPROM is used, but flash, see below.</p>
