0

I am working on a js app which loads some xml files stored in another server. I am using ofcourse XHR to load and access their content.

As a first level I just acces the top level file which contains the name of the elements and I show them in a thumbnail format. My idea is to show the title of the files and the number of items that every element contain. Also and in the second level when the user clicks on one of the elements(thumbnails) I load the content of the clicked element. So I am wandering if my process is performant or not since I load or access the files two times the first when I show the number of items an element contain and in a second time when the user clicks on the element and iI shows its content.

Please what do you think? Is there another good solution? Thanks a lot for your answers :)

1
  • 1
    Maybe you should make that number part of the top level file? Commented Mar 16, 2015 at 14:11

1 Answer 1

1

Making two HTTP requests where you could make one is usually going to be less than ideal. It's certainly going to take a bit longer, although the "bit" may be very small indeed if the browser can satisfy the second request from cache without even a revalidation query to the source server.

It's up to you what to do. If you keep a copy of the response after using it to create the thumbnail, you're using more memory; if you don't and make a second request to the server, you're doing something that could be slightly slower.

Takes your money, makes your choice.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.