Live data from Hacker News

Show HN: Servasm – Literate web server in x86 assembler

zarkzork.com

31–40 of 40 posts

Re: Show HN: Servasm – Literate web server in x86 assembler

#31
post #10

Earlier quoted context omitted.

Thanks, I will look into this. After running ssl test from ssl labs and I some alarming issues https://www.ssllabs.com/ssltest/analyze.html?d=zarkzork.com I should have done it earlier

Surprisingly, I get this fairly often on my mobile. I'm not quite sure what's changed with the last version (or couple) of Android to trigger this. Over-secure, perhaps?

Android mobile browser requires the full signature chain of authorities who signed the site certificate[0]. It is done to avoid calls to CA servers and reduce network use on mobile devices.

If a person does not concatenate authorities signatures to their site certificate, Firefox and mobile Chrome will alert, desktop Chrome and Safari won't.

[0] https://en.wikipedia.org/wiki/OCSP_stapling

Re: Show HN: Servasm – Literate web server in x86 assembler

#32

That's really fascinating and interesting and educating. Now every other http server implementation should need to explain every byte it is larger and every ms it is slower it terms of "why?" and "what for?" and "who gains from this?" ;) I don't know, for longer already I don't buy this tales about "it needs to be this large because..." ... mostly legacy, abstractions and ease of code maintenance etc. This took us al…

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficient compared to any modern one. You know, wasting all those precious CPU cycles you opine so much about?

(Now, if you want to talk about the actual efficacy of HTTP vs other stateless protocols, that's a different story... But I doubt we're going to go there in a thread about an assembly HTTP server where people are ooh'ing over the achivement. Not that it isn't cool, TBQF.)

Programmers at large really need to stop being pretend philosophers clutching at straws about "why things are so darn bad today!!!" (among other psuedo philosophical positions). They're mostly terrible at it, and it's almost always just so damn hamfisted and full of itself.

Re: Show HN: Servasm – Literate web server in x86 assembler

#33

Would love to see benchmark on this versus nginx for fun!

Other than needing to fork for every request, this should be really fast because it uses the efficient sendfile() mechanism in the kernel to handle returning the file and most importantly only implements a bare minimum of support for the protocol. nginx is almost certainly going to be slower because it has to worry about different types of requests, different protocols, IPv4 vs. V6 sockets, CGI, etc... It's easy to m…

Yes, that's what my sense is: it would, within its very limited domain, beat nginx and co. fairly easily.. its interesting because this sort of thing could be made to be modular and thus feature extendable without the overhead if done in a smart enough fashion - many webservices today are sufficiently specialized that they only use a fraction of the features that modern webservers include.

Re: Show HN: Servasm – Literate web server in x86 assembler

#34

That's really fascinating and interesting and educating. Now every other http server implementation should need to explain every byte it is larger and every ms it is slower it terms of "why?" and "what for?" and "who gains from this?" ;) I don't know, for longer already I don't buy this tales about "it needs to be this large because..." ... mostly legacy, abstractions and ease of code maintenance etc. This took us al…

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficie…

Please be a little more charitable when commenting on HN.

There is a long (albeit minority) tradition of thinking this way in computing, one that values small, intelligible systems as the best way for humans to work with computers. An example of this philosophy surfaced here recently (https://news.ycombinator.com/item?id=9689800) and there are countless others.

HN itself has a rich history with this model. It was created by a practitioner of it, is written in a language inspired by it, and the smallness and intelligibility of the code are always on our minds when we work on it.

We need more projects like this. They are deeply satisfying systems to build and work with, because they're human-scale in the way that behemoth software is not.

Re: Show HN: Servasm – Literate web server in x86 assembler

#35
post #34

Earlier quoted context omitted.

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficie…

Please be a little more charitable when commenting on HN. There is a long (albeit minority) tradition of thinking this way in computing, one that values small, intelligible systems as the best way for humans to work with computers. An example of this philosophy surfaced here recently ( https://news.ycombinator.com/item?id=9689800 ) and there are countless others. HN itself has a rich history with this model. It was c…

>There is a long (albeit minority) tradition of thinking this way in computing...

It seems close to the Occam's razor.

https://en.wikipedia.org/wiki/Occam%27s_razor

I like this quote from Chuck Moore (from Forth).

"We need dedicated programmers who commit their careers to single applications. Rewriting them over and over until they’re perfect. Such people will never exist. The world is too full of more interesting things to do. The only hope is to abandon complex software. Embrace simple."

https://www.simple-talk.com/opinion/geek-of-the-week/chuck-m...

Re: Show HN: Servasm – Literate web server in x86 assembler

#36
post #34

Earlier quoted context omitted.

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficie…

Please be a little more charitable when commenting on HN. There is a long (albeit minority) tradition of thinking this way in computing, one that values small, intelligible systems as the best way for humans to work with computers. An example of this philosophy surfaced here recently ( https://news.ycombinator.com/item?id=9689800 ) and there are countless others. HN itself has a rich history with this model. It was c…

Thank you for helping fight the Dijkstras of this world.

thoughtpolice: "because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software"

Dijkstra: "He was the first to make the claim that programming is so inherently complex that (...)" (from Wikipedia)

Down with industry pessimists and "astronauts" that think everything must be complex.

Re: Show HN: Servasm – Literate web server in x86 assembler

#37
post #30
post #26

Earlier quoted context omitted.

I agree that functions are not usually a good one-to-one fit for abstraction. If they were, we wouldn't need variables, loops, blocks etc. Now you could argue that we don't, we should just write code in lambda calculus -- but we don't do that. Especially for languages like assembler and C-like languages, it can be very nice to single out smaller sections of code. And while for eg: C, or I suppose a macro assembler, o…

My version of literate-programming may have a bit too much possibility of that magic. I agree it can be dangerous and is something that takes good discipline, like any programming technique. But at least there is something to fall back on in terms of the narrative. On the flip side of the tangled form, I do appreciate the "flattening" of potential functions. Imagine code that uses a lot of functions, scattered about.…

[ed: I feel I should preface this to say that this is very old code, and something I'd normally show to anyone. But since you asked... :-) ]

Unfortunately it looks like the code that was the best (worst) example of what I'm talking about isn't readily available (I have it some backup-archive or other...) -- and my other code is partially restructured based on what I learnt, and most significantly in Norwegian.

However, one example, while not breaking the function-gap, is a small sub-section from the noweb document that reads (this is java 1.4):

  >=
  import junit.framework.*;
  import junit.extensions.*;

  public class AllTests extends TestCase
  {
    public AllTests(String name) 
    {
       super (name);
    }
	
    public static void main(String[] args) 
    {
       junit.textui.TestRunner.run(AllTests.class);
    }

  >
  >
  >
  }
And the testSucceed-section is just a simplistic sanity check to make sure tests can be run/pass:

  >=
  /** Testing the test harness */
  public void testSucceed() throws Exception 
  {
    assertEquals(10, 10);
  }
These two blocks, the test setup, and the meta-test go together in a neglected corner of the document, given only a little more priority than the build.xml-file -- while the more functional tests are moved close to the various interfaces (in this case) they are testing (rather than having them too close to the implementations they're actually testing).

So one could say that this gives us injection without an injection framework. Or something. This is basically fixing a naming issue in java, where you need methods to be bound to a class (except for static stuff etc) -- and is an "abstraction free" (at the language level) way of moving things that go better together -- closer together.

Note that the blocks pretty much lacks comments, as they are a bit gnarly to get to work with both java and noweb and javadoc -- but that is more of a tooling issue than anything else.

In this case (imagine 10s of test cases) the tests might be a bit under-documented when seen in isolation. Note that each block actually holds a couple of test-cases applicable to whatever class/interface-pair it tests.

But it gets even more interesting when you're sharing a block of code that implements a binary search on an array-like structure... does make it a little too easy to trip over local variables though.

The full code (in Norwegian) is at: http://folk.uib.no/st05861/inf101/oblig1/ -- it's not very good, but the noweb source and pdf (oblig1.nw, oblig1.pdf) might be of some very limited interest -- and could be contrasted with the java code under src.

This is all from an entry level programming course, the task was given as a pdf-document with some specs and a few stub interfaces -- the resulting pdf essentially interleaves the questions/specs as given, along with the interface stubs -- and builds up answers to each sub-section/point.

The other code I mentioned was more along the lines of implementing binary search for a an array-like interface etc -- basically Abstract Data Structures.

Re: Show HN: Servasm – Literate web server in x86 assembler

#38
post #30
post #26

Earlier quoted context omitted.

I agree that functions are not usually a good one-to-one fit for abstraction. If they were, we wouldn't need variables, loops, blocks etc. Now you could argue that we don't, we should just write code in lambda calculus -- but we don't do that. Especially for languages like assembler and C-like languages, it can be very nice to single out smaller sections of code. And while for eg: C, or I suppose a macro assembler, o…

My version of literate-programming may have a bit too much possibility of that magic. I agree it can be dangerous and is something that takes good discipline, like any programming technique. But at least there is something to fall back on in terms of the narrative. On the flip side of the tangled form, I do appreciate the "flattening" of potential functions. Imagine code that uses a lot of functions, scattered about.…

> My version of literate-programming may have a bit too much possibility of that magic.

To be honest, that was (part of) my initial reaction. But at the same time, playing with noweb, reading a bit of literate C etc -- I think some tooling on the literate side can be good. Sometimes one wishes for too much, and too late realize that the beautiful unique snowflake of a poem one has wrought is, while splendid in its simplicity, as brittle and hard as ice.

It just not something one will be entirely comfortable handing over to someone else to modify -- because even if they could figure out what it did, they'd be hard press to modify it in any meaningful way. Too dense isn't very good either.

Sometimes I think that literate programming and APL stand at opposite corners of some kind of 2d graph of program complexity/simplicity (not necessarily diagonally opposed). I'm not entirely sure what would be in the other corners.

I came across your blog post, and I think we are in agreement on a lot of things:

http://jostylr.tumblr.com/post/83304256984/architectural-fog

But I also think a very real problem with literate programming (to quote Knuth?) is that it demands people to be both good (technical) writers and good programmers. Some are both - more are one or the other.

I think the best way to get a simple, yet featureful literate programming system, is to combine a simple markup language, like RST/Markdown/etc with a language that lends itself to be pulled apart and rearranged. I think something simple, like Smalltalk might be a good candidate.

So far the only real literate programming I do, is with doctests in python -- and to a lesser extent, ipython notebooks.

I remember I looked at Leo: http://leoeditor.com/ -- and have been toying with moving from vim to Emacs+evil partially for the benefit of org-mode -- but these still feel like very heavy solutions to something that I feel should be a rather simple problem. That feeling might be wrong, though.

Another tool I've come across (which might be abandoned, I'm not sure) is: http://pywebtool.sourceforge.net/

Regardless of the state of the tool itself, the page has some interesting points on literate programming.

I must admit, getting something like proper LaTeX typsetting of the code is nice though. I'm still looking for a tool that doesn't botch up the (La)TeX conversion and html+css conversion of simple RST/md-documents -- it seems everyone tries to be way too clever, and bundle the weirdest little themes/template leaving one to pick apart everything just to get some straightforward html/TeX. Not to mention trying to output HTML from (La)TeX.

At least for html output we now have a few half-decent alternatives thanks to everyone writing a static blog engine. And pandoc. Pandoc is great.

Re: Show HN: Servasm – Literate web server in x86 assembler

#39

That's really fascinating and interesting and educating. Now every other http server implementation should need to explain every byte it is larger and every ms it is slower it terms of "why?" and "what for?" and "who gains from this?" ;) I don't know, for longer already I don't buy this tales about "it needs to be this large because..." ... mostly legacy, abstractions and ease of code maintenance etc. This took us al…

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficie…

Wow, chillax boy!

You did overlook the ";)", right? I did not intend to pluck that string of yours. Sorry about that.

Re: Show HN: Servasm – Literate web server in x86 assembler

#40

Earlier quoted context omitted.

Are you being serious, or just trying to sound super philosophical about why "less is more"? I assume it's the latter, because it shouldn't take very much thought to see why HTTP servers are fairly complex pieces of software, given the purpose they serve - a class of software that is ruthlessly optimized in today's world - nor should it take very much thought to see this HTTP server is actually ridiculously inefficie…

Wow, chillax boy! You did overlook the ";)", right? I did not intend to pluck that string of yours. Sorry about that.

I chided thoughtpolice for being a little uncharitable, but this comment breaks the HN guidelines outright. It's unsubstantive and uncivil (though I don't think you meant it to be). Please don't post such things.
Post reply on HN