4 ms·
Like a statically linked HTML document? I know you're talking C code, but I could imagine some kind of HTML to C "compiler" that could you then statically link
by mbreese 13y ago
Like a statically linked HTML document? I know you're talking C code, but I could imagine some kind of HTML to C "compiler" that could you then statically link into an executable. Then you could have a full website that ran as a single static executable, including CGI-esque calls.
- icebraining 13y agoIt's actually rather easy: http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967 http://www.linuxjournal.com/content/embedding-file-executabl...
- mbreese 13y agoThat's cool! I wonder if this would be (much) faster than just letting nginx or this embedded httpd read the files directly and serve them. I would hope that the OS or server would cache things enough to make it unnecessary, but it would be interesting to find out. HTML isn't that big, so if you used linked resources, it would be pretty simple to make a C program and compile it to a binary for any purely "static" site.
- damien 13y agoThat's how the Kore web server works ( https://kore.io/ https://kore.io/ ); it makes you generate a static.h file at compile time that contains all of you your static content. But like you say, I have to wonder if it actually makes a difference performance-wise. The kernel will cache the static file data anyways. The only improvement I can see is maybe to avoid having to look up file metadata (length and mtime)? Or to avoid a syscall?