Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

So I've started with the existing Greasemonkey script to add AJAX voting to Perlmonks AJAX replacement for voting buttons and added the ability to lookup the new reputation using the XML version of the nodes. It submits once to vote and then a second time to retrieve the reputation of the node you just voted on. This is required because when casting a vote you have to pass the node_id of the page your are voting from. I'm sure that this could be gotten around somehow.

I then started comparing the characters returned for the XML requests versus the characters returned by processing the entire page, and the page load times (these are the only metrics i could think of to start with, hopefully someone has some better ideas?) So I tested with a node and found out how many characters where needed for each vote. On the node tested it cost about 6k characters for the AJAX vote (and two requests) and 66k characters to load the page. The page load time averages 3s and the 2 XML page load times averaged .3 seconds.

Without better metrics it appears that AJAX voting is cheaper as long as you are voting less than 10 times on a page. 10 ajax votes would cost 60k characters and 3 seconds, about the same as loading the entire page once. If the voting limitation is changed then the cost of AJAX votes could be cut in half, or even less if the request could specifiy it only wants the reputation XML.

I was hoping to find that this could significantly enhance server performance. I'm not sure I've found that, but i do beleive that if the average number of votes per page is low (say < 6) then this could result in a great improvment in perlmonks performance.

So is this something we want to look into supporting to some degree? I.e. have a greasemonkey plugin with special XML syntax, or even provide javascript that could be entered into the freenodelet? or is this performance increase insignificant?

I would be interested to see if there are other aspects that could benefit from some AJAX as either a freenodelet code or greasemonkey script. Please express your opinions!

Install - Sorry I couldn't figure out a proper bracket to do the job.

Eric Hodges

In reply to Perlmonks AJAX Voting by eric256

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.