|We don't bite newbies here... much|
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.
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.