phrygius wrote:
> ...
> My testing so far is _nowhere_ near those numbers, and I have begun to
> wonder if I will encounter problems of scale in the future.  Do you
> expect that I will have browser crashing or slow-down?
> ...
I have an "offline" application that starts out by loading ~200kb of 
JSON data into JavaScript objects.  I have found that IE6 is the most 
feeble browser when it comes to large amounts of html, but it scales 
pretty well with JavaScript memory.  The things that don't scale well on 
_IE6_ are:


1. DOM size: I originally tried a large document instead of the 200kb of 
JSON where I used JavaScript to show/hide relevant data for different 
actions.  In IE this was very slow to load and add observers (over 5 
minutes for 500kb of html and consuming 90MB RAM) and seemed to slow 
down exponentially as DOM size increased.  I ended up storing JavaScript 
objects in memory and setting innerHTML of content panes based on html 
templates.

2. appendNode(): Building html strings and calling innerHTML is 3 to 5 
times faster than createElement() and appendNode() (and innerHTML is 
standard in html5!)

3. Iteration using each(): With extremely large arrays and objects, for 
and while loops are a must.

4. Sorting: Don't even _try_ to sort large arrays in IE6.

5. Objects instead of arrays: I found that using objects like 
associative arrays takes up too much memory--use numerically indexed 
arrays instead.

6. ActiveX Filters: You can easily crash IE6 if you use ActiveX PNG 
transparency filters on more than a handful of images on a page.


After making changes along these lines, the application is very 
responsive in IE6.  I also didn't experience any noticeable slowdowns 
when unserializing the initial JSON data or serializing the result data 
for posting back to the server.  Serialization in IE6 is definitely 
slower than in Firefox, but was not a problem for me.

The crazy thing is that all my tests showed Firefox scaling very well.  
With 500kb of html and thousands of Event.observe() and each() calls and 
sorting of large objects, Firefox took only about 3 seconds.

When testing IE6 with 500kb of HTML, I never got it to crash, but I did 
get the "Script is running slowly" warning--which to users looks like a 
catastrophic error :)

Happy coding

- Ken
 Snyder

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to