Calculating usage of localStorage space

后端 未结 12 1540
悲哀的现实
悲哀的现实 2020-11-27 10:28

I am creating an app using the Bespin editor and HTML5\'s localStorage. It stores all files locally and helps with grammar, uses JSLint and some other parsers for CSS and HT

12条回答
  •  萌比男神i
    2020-11-27 10:57

    Wish I could add this in a comment - not enough rep, sorry.

    I ran some perf tests - expecting JSON.stringify(localStorage).length to be an expensive op at large localStorage occupancy.

    http://jsperf.com/occupied-localstorage-json-stringify-length

    It is indeed so - about 50x more expensive than keeping track of what you're storing, and gets worse the fuller localStorage gets.

提交回复
热议问题