I am working on a mobile web site (mostly for Android) and I would like to store a string (around 20 characters) on client side. I wonder which way is more efficient on performance wise, local storage or cookie? I will use JavaScript to write both cookie or local storage. Server is not going to work in any part to create cookie.
I found some test results for this but they didn't seem accurate to me. And also found some questions on stack overflow but they didn't answer my question too. If is there anyone who knows a good article or test please help.
Even if I can't come up with some jsPerf examples, localStorage access times should definitely be faster than reading out cookies. But thats not your only concern on that context, especially when you're dealing with mobile devices where request times and performance is cruicial.
That means, cookies will get attached to HTTP Request whereas localStorage data will not.
My suggestions clearly is the localStorage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With