Best practices question regarding memory
I am currently in the approval process with my widget. In my widget, I maintain a list of the user's bookmarks as well as user information used to render content. All information is stored in the currentAppData class, retrieved at launch and stored in a variable accessible to all views.
One of the pieces of feedback I got from the Yahoo team was that I should limit the amount of "global" variables that I maintain. I was looking at these objects and wondering if it would be more efficient to simply grab them from currentAppData whenever I need them. The caveat here is that I'm storing several of these objects as stringified JSON objects, and so I need to invoke the JSON.parse (and stringify) methods everytime I grab (or set) the data. I guess what I'm asking is: Is it more efficient to grab the info from currentAppData and parse JSON when I need the data or use global objects that are filled at launch (and updated through any user actions)?
by
1 Reply