add gwan to bigtable benchmark
https://gist.github.com/878224
feel free to add it in your benchmark.
gwan:http://www.trustleap.com/
Hi redaready,
thank you very much for that code. I assume that it will give us a great performance baseline. However, from what I understand of your code you are neither using UTF-8 encoding nor are you HTML escaping the dynamically generated table content. I understand that for the numbers in the bigtable benchmark escaping is unnecessary. However we do the escaping, as the benchmark should reflect the performance in real use cases as good as possible. For many real use cases, its very hard and error prone to get rid of escaping dynamically generated content.
best regards and thanks again, Simon
I totally agree with you about escaping the content and just updated the code for g-wan 2.0+. I think the string of gwan has the same encoding as the source file.....i am waiting for the more-than-expected release of gwan to test the changes of api and performance.
Thanks for updating the code. I had a quick glance at it and I'm surprised that there's no way to do a printf_html_escaped in gwan. If code really has to be written, as you show, then this seems both detrimental to performance (superfluous buffer copies) as well as very risky with respect to buffer overflows.
hi, did you add g-wan to your benchmarks? how does it perform?
No we did not do that yet due to a lack of development ressources. We'd however happily accept patches..as usual :-)
Sure thing, I was just curious because the patch above looked good to me. There's a way to do a printf_html_escaped in gwan, the patch above does exactly that, I think he should've commented it to make it clear. :)
// escapes the content of buffer, which is the desired html
line 23 escape_html(buffer,buffer,100);
// prints the html_escaped (modified) buffer back into the http body
line 24 xbuf_xcat(reply, "<td>%s</td>",buffer);
to printf into the console you can simply printf("<td>%s</td>",buffer); but xbuf_xcat() is the right way to output into the browser. To run the example you just extract G-WAN into a directory, copy the gist above into whatever.c put it into the csp folder in 0.0.0.0_8080/#0.0.0.0/csp then enter localhost:8080/csp/whatever.c in your browser.
These are other "html_escaping functions" available in G-WAN:
// ============================================================================
// HTML escaping
// ----------------------------------------------------------------------------
u32 url_encode (u8 *dst, u8 *src, u32 maxdstlen); // return len
u32 escape_html (u8 *dst, u8 *src, u32 maxdstlen); // return len
u32 unescape_html(u8 *str); // inplace, return len
int html2txt (u8 *html, u8 *text, int maxtxlen); // return len
Pierre,the creator of gwan, has written a better version cf:https://gist.github.com/2001619
Thank's I'll look into that.