Hi Joe,

Joe Bogner <joebog...@gmail.com> writes:
> I was playing around with your demo and ran a little bookmarklet that
> would refresh the stepped version automatically.
>
> I first included jquery through a bookmarklet. Then, I pasted this
> into my javascript console window:
>
> var refresh = function(location) { 
>     $.get(location, function(x) { 
>         var $html = $(x);
>         var url = $html.find('a:contains(step)').attr("href");
>         console.log(url);
>         var svg = $html.find('svg');
>         $('svg').replaceWith(svg.get(0));
>         setTimeout(function() { refresh(url) }, 500)
>     })
> }
> refresh($('a:contains(step)').attr("href"));
>
> I think this appears more seamless (like the iframe approach) instead
> of doing a full page refresh.

very nice, thank you!  I see that there are many ways to refresh the
graph:-)

The way the clicks are handled on the server might not work currently
with this code though.  Have you tried clicking on a link outside the
refreshed area?  Does it break?  But that's my problem, and it is
fixable.

> It looks like Alex's approach is about 15x lighter on the wire. I ran
> fiddler and it looks like it transmits upwards of 639 bytes for a full
> chart whereas the svg is around 9500 bytes. Still, it's an neat
> alternative! 

yeah, but 

1) if you look at the page source, you'll see that most of the svg is to
   make the graph clickable and add bubbles which Alex' version doesn't
   do.  If that is removed, it might get down significantly simply by
   implementing only the functionality back to what Alex' demo does.

2) The server could serve the content gzipped if desired.  How much
   would it shrink the content?  Would it be smaller than 639 bytes?  I
   haven't tried but it seems possible, at least getting it down to
   comparable size.

   Could plio gzip the bytes?

3) I guess most of the overhead of the http request is probably
   establishing the connection.  My bett is that it doesn't really
   matter if you send 1kB or 5kB of data.  For example, if I run this
   locally, it takes 3--7ms to refresh the page in the browser.  Running
   from logand.com, it takes about 65--75ms to refresh.  If I set up ssh
   tunnel from my local pc via logand.com, it takes about 250ms.  So I
   don't think it makes much difference if I send a few kB more, the
   most important thing is how are these bytes routed.

Cheers,

Tomas
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to