Does Firebase cache the data?
<p>I read somewhere a claim that Firebase caches the data.</p>

<p>So I ran <a href="https://jsfiddle.net/b3a62avs/" rel="noreferrer">this test</a> that reads a semi large volume of data (about 400KB).</p>

<p>Here is the relevant code.</p>

<pre><code>firebase.initializeApp(config);

var counter = 0;

console.time('firebase answered in');
firebase.database().ref('texts').once('value',onData);

function onData(snapshot){
  console.timeEnd('firebase answered in');

  counter ++;
  if(counter &gt; 20) return;

  setTimeout(function(){
    console.time('firebase answered in');
    firebase.database().ref('texts').once('value',onData);
  },2000);
}
</code></pre>

<p>As you can see, the first time it loads data it takes a while, and subsequent calls take much less time.</p>

<blockquote>
  <p>firebase answered in: 1279.422ms</p>
  
  <p>firebase answered in: 236.378ms</p>
  
  <p>firebase answered in: 228.595ms</p>
  
  <p>firebase answered in: 202.700ms</p>
  
  <p>firebase answered in: 208.371ms</p>
  
  <p>firebase answered in: 214.807ms</p>
  
  <p>etc</p>
</blockquote>

<p>But, still, if the data is cached locally <code>~200ms</code> (sometimes more) seems like a lot of time to access local data. Enough for the user to perceive a delay when rendering the UI.</p>

<p>So is Firebase caching the data? What is happening in those <code>~200ms</code>?</p>