Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gwan to bigtable benchmark #37

Open
redaready opened this issue Mar 20, 2011 · 8 comments
Open

add gwan to bigtable benchmark #37

redaready opened this issue Mar 20, 2011 · 8 comments

Comments

@redaready
Copy link

https://gist.github.com/878224

feel free to add it in your benchmark.
gwan:http://www.trustleap.com/

@meiersi
Copy link
Collaborator

meiersi commented Mar 21, 2011

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

@redaready
Copy link
Author

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.

@meiersi
Copy link
Collaborator

meiersi commented Mar 24, 2011

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.

@X4
Copy link

X4 commented Mar 5, 2012

hi, did you add g-wan to your benchmarks?
how does it perform?

@meiersi
Copy link
Collaborator

meiersi commented Mar 5, 2012

No we did not do that yet due to a lack of development ressources. We'd however happily accept patches..as usual :-)

@X4
Copy link

X4 commented Mar 5, 2012

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

@redaready
Copy link
Author

Pierre,the creator of gwan, has written a better version cf:https://gist.github.com/2001619

@meiersi
Copy link
Collaborator

meiersi commented Mar 10, 2012

Thank's I'll look into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants