Live data from Hacker News

Web server for Linux written in amd64 assembly

github.com

51–59 of 59 posts

Re: Web server for Linux written in amd64 assembly

#51
post #37

I wonder how fast is this server. Is handwritten assembly faster than GCC/clang-written assembly?

I don't want to be too harsh - this is a fun idea, and I'm prone to silly fantasies about rewriting slow code in assembly myself - but this particular assembly doesn't take advantage of many of the "dirty tricks" that are available in low-level code. As one example, check out the content-type detection, which is essentially a long chain of repeated strlen + strcmp; assembly language doesn't magically make bad algorit…

Not to mention that long chain is ugly to read. I would rather see a macro defined and called multiple times than to see the same block of code copy/pasted over and over.

Re: Web server for Linux written in amd64 assembly

#52
post #45

Earlier quoted context omitted.

I guess he's talking about Borland's Turbo Assembler that was coming with Turbo Pascal: http://en.wikipedia.org/wiki/Turbo_Assembler

My remark was because the OP used bytecode to describe assembly opcodes.

The usage is nonstandard, but it provides an interesting perspective. What if he was planning to run the X86 code on a virtual CPU, is his usage then correct? Does the nature of compiled code change if it is executing on a "real" machine instead of a virtual one?

Re: Web server for Linux written in amd64 assembly

#54
post #36

Earlier quoted context omitted.

Security through transparency and readability for a bigger audience.

That's a great reason not to use this. Doesn't seem a reason not to do it.

That's exactly right.

I wrote a web server in C. I'm not really a web guy, it was a lot of new stuff to me, I'm a pretty amateurish programmer, and it probably doesn't even deserve to be called a "web server". But it was fun, and really cool to know that something that I wrote (with the help/jump-off point of a tutorial or two) can be used to serve web pages to a client. I can run the program, pop open Firefox, and use the browser to click through a set of test pages as though it was being served by a real web server. That's fucking cool, and that was all the reason that I needed to do it.

Don't Reinvent The Wheel - unless you want to!

Re: Web server for Linux written in amd64 assembly

#56
post #52
post #45

Earlier quoted context omitted.

My remark was because the OP used bytecode to describe assembly opcodes.

The usage is nonstandard, but it provides an interesting perspective. What if he was planning to run the X86 code on a virtual CPU, is his usage then correct? Does the nature of compiled code change if it is executing on a "real" machine instead of a virtual one?

I would say yes, given that some bytecode instruction sets make a CISC processor look like a RISC one.
Post reply on HN