Hello again!
I have been making progress since the last time we discussed the
issue. I believe I have solved my issue by finishing the development
of a JavaScript Abstraction Library for SVG and VML. With the library
I designed I am able to generate either SVG/VML polygons and then
change whatever attributes I'd like on them once they have been
rendered on the map.
My initial tests suggest that this does at the very least
significantly slow the rate at which memory usage increases in
browsers, (and may in some cases stop leaks all-together), because I
am able to take an approach where I create just the elements that I
need then only modify attributes on them. It seems removing,
creating, and then adding elements (with no events or any
complications) still isn't perfect in terms of having memory
reclaimed.
Anyhow I have a test application hosted here:
http://www.nstb.tc.faa.gov/v3jsvgvml/
It generates 10 Polygons on the map, then after 2 seconds begins to
change the points on the polygons randomly every second. The test
also has a slider which allows the user to change the opacity value on
all of the polygons while this is happening. I have tested this to at
least render and work in IE6, IE7, IE8, Safari 5, Opera 11, Chrome 8,
and FF 3. Tonight I intend to begin examining specifically how much
this approach helps with memory usage, by allowing the browsers to run
this page for extended periods of time.
I'd love to share my source code for the library, but unfortunately
I'm not able to. But Bratliff, thank you for your insights, our
conversation definitely helped reinforce my motivation that this was
something that I needed to complete, because the V3 API is not going
to do what I need.
On Dec 15 2010, 1:40 pm, bratliff <[email protected]> wrote:
> On Dec 8, 8:09 pm, John Mick <[email protected]> wrote:
>
> > Hey sorry for the delay - I ended up getting pretty sick over the
> > weekend and haven't been back into the office until today.
>
> > I was all setup to run your test on Friday under IE8 - Chrome - and
> > Firefox, but the interval on calling Cycle was changed from the
> > previous 3 seconds to 0 ms. Opening the test in those 3 browsers
> > (each full-screen on one of 3 monitors) had my CPU usage hanging out
> > at around 60%+. I didn't really want to tax the work machine that
> > badly over the weekend so I elected to not run the test.
>
> Feel free to make changes to the test case. I was trying to compare
> CANVAS, SVG & VML rendering speeds.
>
> > Anyhow I am glad that our discussions helped you find some ways to
> > improve your library - it is a very impressive.
>
> > I definitely recommend using SVG as a default over CANVAS. Though
> > both SVG and CANVAS require the browser to render the individual
> > pixels when they are displayed - CANVAS, being bitmap based, has to
> > store a value for what it is that it is going to draw on every point -
> > unlike SVG which uses a more mathematical vector approach. In testing
> > - I found that very very very large CANVAS objects took significantly
> > more memory to render than SVG objects of the same size.
>
> For dragging, panning & zooming, CANVAS is much quicker. But CANVAS
> does not support mouse events. If a browser supports both, the choice
> depends on whether event listeners are specified.
>
> You can see the performance differences at:
>
> http://www.polylib.us
>
> if you choose the experimental "United States" demo. Toggle
> "Clickable - true" / "Clickable - false" to switch between SVG &
> CANVAS respectively.
>
> > I also found that increasing the scale of an SVG object doesn't
> > necessarily increase the memory usage - if we are only talking about
> > rendering - when the SVG object falls outside of the viewpoint of the
> > browser itself (if the object was being drawn off-screen).
>
> > I am going to continue working on tweaking my own custom solution -
> > which overlays very large SVG objects over the map once - then alters
> > those objects directly whenever data changes, instead of deleting and
> > re-creating new ones. Time to refresh my memory on how to embed those
> > VML script and namespace tags.
>
> Are you making progress ? I will be happy to help.
>
>
>
>
>
>
>
> > Thanks again for your help as well - it feels significantly better
> > knowing that somebody else out there has some real experience with
> > problems like this. (I've felt so alone for awhile! Haha)
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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/google-maps-js-api-v3?hl=en.