https://www.slideshare.net/kazuho/h2o-20141103pptx
The developer says that 'h2o server' is fast using qrintf as I see ppt.
sprintf parses at runtime,
qrintf parses at compile time.
So qrintf is fast.
Conceptually, I understand.
When do you use it?
Only when returning ip4 address as string?
Then I do not understand.
Is not the web server already run-time after compilation?
In other words, my question is
When is qrintf used?
And
Why is qrintf fast?
There are two.
Hi @voiddeveloper ,
I am looking at h2o for the first time, so take my reply with a grain of salt.
TL;DR: https://github.com/h2o/h2o/search?l=C&q=sprintf&type=&utf8=%E2%9C%93
As described in https://github.com/h2o/h2o/issues/796, qrintf is simply a compile-time optimization of sprintf-calls. Once specified as compiler option, it analyzes and replaces certain tags, such as:
%c
%s
%d (modifiers: h, l, ll)
%u,%x,%X (modifiers: h, l, ll, z)
Source: https://github.com/h2o/qrintf
From what I grasp of it, it basically analyzes the "format" part of the string at compile-time, so it'll be able to insert the parameters quicker on run-time (because it already "knows" where to put them).
Thank you for kindly explaining. I understood why it was fast.
However, I do not know when this method is used.
Do you know anything about it?
Most helpful comment
Hi @voiddeveloper ,
I am looking at h2o for the first time, so take my reply with a grain of salt.
TL;DR: https://github.com/h2o/h2o/search?l=C&q=sprintf&type=&utf8=%E2%9C%93
As described in https://github.com/h2o/h2o/issues/796,
qrintfis simply a compile-time optimization ofsprintf-calls. Once specified as compiler option, it analyzes and replaces certain tags, such as:Source: https://github.com/h2o/qrintf
From what I grasp of it, it basically analyzes the "format" part of the string at compile-time, so it'll be able to insert the parameters quicker on run-time (because it already "knows" where to put them).