views:

45

answers:

1

I need to fetch some chunks of data in a Javascript loop. The pieces will probably be small between 2 and 20 Kb but being in a loop I need speed. I can get these pieces of code from local storage:

var code = localStorage.getItem(myVar);

or even from jQuery .data()

var code = $('#myDiv').data(myVar);

I was unable to find info on localStorage or sesionStorage speed or if I can cache these values into memory.

What would be fastest and better to use? Thanx

A: 

http://www.html5rocks.com/tutorials/speed/quick/#toc-databases

As a rule of thumb: The more data you have, the more appropriate the client-side databases become. To find the break-even point, you'll have do do some testing i suppose.

DanMan