Search the web
Sign In
New User? Sign Up
json · JSON JavaScript Object Notation
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Iterating through a huge JSON variable - freezes FF   Message List  
Reply | Forward Message #708 of 1408 |
Hello,

I am trying to iterate through a big JSON variable (about 1500 nodes).
It works but FF pops up with the message saying the script is not
responding (A script on this page may be busy... do you want to stop
the script, debug, continue). If I select continue, it works fine. It
is just that the iteration takes a bit of time to go through all the
nodes. Is there a way to avoid the above? I searched a bit the net and
it is not very clear how to do so as JS is not multithreaded from what
I could gather. However, I am sure, there could be some asynchron
iteration releasing the cpu from time to time to ensure nothing else
needs to be done on the page.

Any ideas?

/Carl




Wed Feb 7, 2007 12:07 pm

carl.harroch
Offline Offline
Send Email Send Email

Forward
Message #708 of 1408 |
Expand Messages Author Sort by Date

Hello, I am trying to iterate through a big JSON variable (about 1500 nodes). It works but FF pops up with the message saying the script is not responding (A...
carl.harroch
Offline Send Email
Feb 7, 2007
12:08 pm

The warning is meant to protect users from scripts that might be or are abusing the system resources, the solution is not to get rid of the message but to...
Matthew Morley
mpcmtechnolo...
Offline Send Email
Feb 7, 2007
2:12 pm

Hello Mathew, ... var jsonTest = Class.create(); jsonTest.prototype = { allData: [{attributes: {name: "", id: ""}}], myData: [{attributes: {name: "", id:...
carl.harroch
Offline Send Email
Feb 7, 2007
4:09 pm

... Nitpick: this isn't valid JSON, get those hash keys quoted. ... Iterating over 2000 of anything in Javascript is going to cause problems for most browsers...
Michal Migurski
michal_migurski
Offline Send Email
Feb 7, 2007
4:50 pm

I wonder if something like this: ...
Mark Ireland
akaidr4vr
Offline Send Email
Feb 8, 2007
12:42 am

... It was generated with the JSON addin to RoR. Will look into that later on. I try to avoid the trip back to the server and download the list just once....
carl.harroch
Offline Send Email
Feb 8, 2007
12:42 pm

Once we've had long running script on the client-side, which took about 1 minutes to execute/parse/display the data(a two dimensional array with thousands of...
mertsakarya@...
mertsakarya
Offline Send Email
Feb 8, 2007
6:17 am

One more thought, Why not use [ [<name, string>, <id, string>],... (array) notation instead of [{attributes: {name: "", id: ""}}], ? Mert ... From:...
mertsakarya@...
mertsakarya
Offline Send Email
Feb 8, 2007
6:18 am

... Yuck, file a bug report. There's no excuse for generating javascript and calling it JSON. ... Maybe, though it depends on how long it takes to parse the...
Michal Migurski
michal_migurski
Offline Send Email
Feb 8, 2007
5:17 pm

Thanks Mike, I beleive I will go for your last solution. Currently I am working on several part of my site which does not permit a lot of time on the iterating...
carl.harroch
Offline Send Email
Feb 15, 2007
12:05 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help