Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8411359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:24:20+00:00 2026-06-10T00:24:20+00:00

I’m building a web application using Firebase that takes the same data and presents

  • 0

I’m building a web application using Firebase that takes the same data and presents it in two different ways – in a list and as an markers on a google map.

Right now, in each view – map or list – I have code to query data from firebase, merge it together, and display it. Instead, I’m considering this plan: on startup, query the data, merge it, and save it all into an array that I pass from view to view.

In a sense, I am “caching” the firebase data in an array. This isn’t ideal in one sense – cached data isn’t as up-to-date as directly querying Firebase. On the other hand, I only call Firebase once.

Does this make performance sense? Does reading data from a Firebase take within the same order of magnitude time as reading data from an array?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:24:20+00:00Added an answer on June 10, 2026 at 12:24 am

    In general, caching data to limit use of Firebase is unnecessary. Firebase maintains its own cache of “active” data on the client. “Active” is defined as data for which an “on” call is outstanding on it. Therefore for any active data, any additional “on” or “once” calls will require no network traffic as the data has already been loaded.

    I’m not entirely sure what you mean by “querying firebase”. Firebase does not have queries in the traditional sense. It simply has methods for attaching callbacks. Are you using the “once()” function to get data periodically from Firebase? If so this could potentially be very inefficient. Once is a convenience method and should generally only be used for data that is accessed extremely infrequently or that for some reason the developer does not want to update in real-time. If no active “on” calls are outstanding when the once() completes, Firebase will flush the cache of that data, and any subsequent calls to once() will require a roundtrip to the server.

    If what you want is a way to synchronously access a local copy of the latest version of the data in an efficient way, I recommend this method:

    var savedSnapshot = null;
    dataRef.on("value", function(snapshot) {
      savedSnapshot = snapshot;
    });
    
    //and then when you need to read the data
    var theData = savedSnapshot.val()
    

    By maintaining one single on() call, Firebase is able to keep your data up-to-date by only sending deltas over the wire when things change, rather than reloading all of the data every time you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.