[HN Gopher] A forum engine written in Assembly
       ___________________________________________________________________
        
       A forum engine written in Assembly
        
       Author : utf_8x
       Score  : 96 points
       Date   : 2023-08-27 18:05 UTC (4 hours ago)
        
 (HTM) web link (asm32.info)
 (TXT) w3m dump (asm32.info)
        
       | flumpcakes wrote:
       | This is amazingly fast to my eyes.
       | 
       | I am endlessly annoyed by slow interfaces. At $DAYJOB I have to
       | use a web and desktop GUI for managing CheckPoint firewalls.
       | These often will freeze for dozens of seconds, and generally make
       | my computer crawl. I feel that this should not be acceptable in
       | 2023.
        
         | aleph_minus_one wrote:
         | > I am endlessly annoyed by slow interfaces. At $DAYJOB I have
         | to use a web and desktop GUI for managing CheckPoint firewalls.
         | These often will freeze for dozens of seconds, and generally
         | make my computer crawl. I feel that this should not be
         | acceptable in 2023.
         | 
         | This is probably not a problem of the principal slowness of the
         | software. With a high likelihood (source: personal programming
         | experience of my colleagues and me), the root cause when the
         | GUI freezes in such situation is typically rather that some
         | operation that needs a little bit of time (say, a server
         | request) is done in the GUI thread, thus blocking the
         | processing of any other event (message). Windows programming is
         | very sensitive in this regard.
        
           | fredrikholm wrote:
           | > and generally make my computer crawl.
           | 
           | Sounds like its worse than that.
        
         | eterps wrote:
         | The D forum is also quite fast: https://forum.dlang.org/
        
       | alberth wrote:
       | It makes me happy to see people still build stuff like this.
       | 
       | Also interesting that they host their code on Fossil, which
       | itself has a builtin forum engine written in C.
       | 
       | https://www2.fossil-scm.org/home/doc/trunk/www/forum.wiki
        
       | mhd wrote:
       | I looked into maybe using this a few months ago, but decided
       | against it.
       | 
       | https://board.asm32.info/hi-johnfound-welcome-back.351/#1624...
        
         | 10000truths wrote:
         | What the hell are those god-awful notifications that keep
         | spamming the bottom right corner of the page? I can't seem to
         | turn them off.
        
           | mcint wrote:
           | There's a bell icon in the header, it toggles the real-time
           | notifications. Took me a minute to find it too.
        
             | StingyJelly wrote:
             | I went straight to ublock element picker without thinking
             | about it
             | 
             | board.asm32.info##div.info.toast
        
           | xigency wrote:
           | Would be fine if they didn't cover the content on the page,
           | but maybe that's a mobile problem.
        
         | [deleted]
        
         | YeBanKo wrote:
         | I just checkout out the chat functionality and the first thing
         | I saw there was a a bunch of obscene racists messages in
         | Russian.
        
         | veavo wrote:
         | [flagged]
        
           | Genwald wrote:
           | I don't understand this all or nothing rebuttal. You can
           | avoid supporting an individual that you don't like without
           | doing background checks on everyone involved with everything
           | you use.
           | 
           | Also, not supporting the Russian invasion of Ukraine is not
           | about not supporting communism.
        
           | thaumaturgy wrote:
           | If the only classification you have for supporting the brutal
           | genocide of a people is "wrong political opinion", then you
           | have woefully inadequate mental models for the world around
           | you.
        
           | wetpaws wrote:
           | [dead]
        
           | 0xDEF wrote:
           | Where do you see "commmunists"? Did you check the link? The
           | chat functionality is full of racist messages in Russian.
        
           | mhh__ wrote:
           | Not that many in my experience at least.
        
           | charsii wrote:
           | It's still always better to do N-1 than N evil things.
        
           | jacquesm wrote:
           | This is a bit more than a 'wrong political opinion', this is
           | outright support for genocide.
           | 
           | "The Nazi plague must to be eradicated from Ukrainian
           | society. "
           | 
           | Fuck that shit.
        
             | karmakurtisaani wrote:
             | Yep. When someone holds a view like that, they come off as
             | an unstable or delusional person. Using a product from such
             | a person can quickly become a liability.
        
             | pessimizer wrote:
             | [flagged]
        
             | YeBanKo wrote:
             | This is almost verbatim translation of the top putin's
             | propagandist.
        
           | cultofmetatron wrote:
           | > If you really took that to heart you would be unable to use
           | a computer at all.
           | 
           | yea no kidding. its like these people never looked up von
           | Neumann. https://en.wikipedia.org/wiki/John_von_Neumann
        
             | jacquesm wrote:
             | What's so bad about von Neumann?
        
             | karmakurtisaani wrote:
             | You mean his stance on the whole nuclear war thing? At
             | least with that I can kind of see where he was coming from,
             | but this forum guy just seems delusional.
        
               | cultofmetatron wrote:
               | > but this forum guy just seems delusional.
               | 
               | as someone who spent 3 months in ukraine in 2020, I
               | agree. I have nothing but nice things to say about the
               | Ukrainian people. I'm not white and I was never once
               | disrespected. I have no idea what this guys is talking
               | about when it cones to "nazis in ukraine." I never once
               | came across such people.
        
               | 0xDEF wrote:
               | You replied to the wrong comment.
               | 
               | But you're right. I would say Hungary and eastern Germany
               | (excluding Berlin) are more racist than Poland and
               | Ukraine.
        
               | pessimizer wrote:
               | Nazis are all over Eastern Europe, it's something that
               | happened to a certain segment of young men after the end
               | of communism, was born largely from imported racist
               | material from the US and Western Europe, and was fed by
               | inspiration from UK and Italian football hooliganism
               | (Casuals, Ultras, etc.) and "National Socialist Black
               | Metal" _which is actually a genre of music._ People
               | involved in these scenes formed gangs that developed into
               | militias, some of the people in these militias were the
               | children of oligarchs and politicians, and they used
               | those gangs to enforce local collection rackets and to
               | commit political violence. This isn 't a story about just
               | Ukraine, it's more a story about Russia, Ukraine, and
               | Poland.
               | 
               | Having oligarchs connected to Nazi militias was an ideal
               | way for the US to get money and arms into Ukraine to fuel
               | the 2014 coup. It was simply a marriage of convenience,
               | but one that propelled Nazis into a lot of power on the
               | ground and in some of the institutions of Ukraine.
               | Ukrainian Nazis think of Russians as a racially
               | mongrelized people, and were happy to help wage war on
               | Russian speakers in Ukraine as a war of racial cleansing.
               | Also, their newly heroic status in some of the
               | conservative mainstream quarters of Ukraine (combined
               | with the forcing of Russian speakers to the East),
               | allowed them to racialize Ukrainian identity. As we
               | poured money and arms into the country, the Nazi militias
               | became more and more official, and more and more the
               | direct recipient of those arms.
               | 
               | The rise of the Nazis has largely been inflicted on
               | Ukraine by US manipulation. They're just another instance
               | of "freedom fighters" and "moderate rebels" that we fund
               | to get what we want. When Ukraine voted for an actor who
               | played the president on TV, they were taking the same
               | desperate stand against the powers-that-be (in this case
               | Russia and the US) as the US was when they elected Trump
               | (against the Democrats and Republicans.) They were voting
               | for peace, and an end to corruption. It didn't go well.
        
               | sam_lowry_ wrote:
               | > this forum guy just seems delusional
               | 
               | Bingo. Choosing forum software is choosing a long-term
               | commitment.
               | 
               | Someone expressing such views is not just of a different
               | political spectrum, he has a fragile mind.
               | 
               | Making a forum in assembler probably requires such a
               | mind, but I would rather choose greedy, drugs-dependant
               | but reasonsbly normal Drupalers than this dude.
        
           | pessimizer wrote:
           | > If you really took that to heart you would be unable to use
           | a computer at all.
           | 
           | Or any transistor. Although Shockley certainly wasn't a
           | communist, so maybe his views are more appealing?
           | 
           | https://en.wikipedia.org/wiki/William_Shockley
        
         | serf wrote:
         | to each his own, but I can't really use a computer without
         | implicating myself with software written by people with totally
         | different ethics/philosophy/politic than myself; in fact I
         | think that no one can.
         | 
         | if you find a software stack that aligns itself perfectly with
         | any single dogma (outside maybe TempleOS) then let me know, but
         | right now that seems like a pipe dream.
         | 
         | I mean, just as food for thought, is there any common-use
         | cryptography without major ties to war parties and national
         | security groups?
         | 
         | aside: I can think of plenty of more practical reasons to avoid
         | a net-facing forum software written in asm in 2023.
        
           | winternewt wrote:
           | I don't think it's a black-or-white thing. You weigh pros and
           | cons. Linus can be a bit of a jerk but the Linux kernel is
           | immensely useful to me, so I use it in spite of some
           | misgivings. This software, on the other hand, is mostly a fun
           | curiosity and the author is promoting actual genocide. So in
           | this case I'll say no thanks.
        
         | RagnarD wrote:
         | It's an indication that someone can be a good programmer while
         | still lapping up Putin's propaganda.
         | 
         | On a related note, I somewhat recently posted just the link to
         | the very religious SQLite ethics page on Facebook - which
         | immediately flagged it as some objectionable something or
         | other. _Just a link_ to a web page of one of the most popular
         | open source packages on the planet which Facebook itself no
         | doubt uses. They 're so incredibly leftist that their
         | algorithms can't even abide linking to a religiously oriented
         | page.
        
         | 0xDEF wrote:
         | Thanks for posting. In the .Net world we had the whole Moq
         | library drama recently. Now I check the social media of library
         | creators before I use the library. I'm sorry but I cannot trust
         | deranged people's code in production systems.
        
         | ndegruchy wrote:
         | Ugh, yeah. That's unfortunate.
        
       | sctb wrote:
       | The flat assembler (which assembles this project) is worth
       | checking out if you haven't already: https://flatassembler.net. I
       | first played around with it almost 20 years ago and it was
       | noticeably more ergonomic and productive than masm, nasm, to say
       | nothing of gas. I imagine it was designed for human programmers
       | rather than primarily compiler front ends, so it's a popular
       | choice for hand-written assembly projects.
        
       | jbm wrote:
       | I don't understand -- isn't the speed mostly limited by network
       | or disk access? Is there a significant improvement by having the
       | underlying code in Assembly?
       | 
       | A very cool application regardless, I haven't seen Assembly since
       | college now.
        
         | theamk wrote:
         | yes, the speed is mostly limited by network/disk; no, there is
         | no improvement from writing entire thing in assembly
         | (optimizing a few hot functions is a different story)
         | 
         | I have not looked at this at this software in particular, but
         | the few assembly web engines I have looked at in the past had
         | worse performance that C versions due to making a much higher
         | number of syscalls. For example, multiple send calls per
         | response; lack of pool allocators; etc...
        
         | alberth wrote:
         | The website being only 65kb in total size, all inlined with no
         | additional downloads, plays a _massive_ role in its performance
         | no doubt.
         | 
         | Regardless of what language is serving up the request.
         | 
         | Still neat though.
        
           | jacquesm wrote:
           | That means it fits in cache in its entirety. I've found this
           | often to be the biggest factor: reduce the size of the 'hot'
           | set so it fits in cache and you can see crazy speed
           | improvements.
        
             | [deleted]
        
         | jacquesm wrote:
         | That depends. If you do more complex stuff you can easily be
         | CPU bound, but if you're just pumping data then likely the
         | network will be your first limit. Caching should take care of
         | the disk as a limitation (besides that, SSDs are wicked fast).
        
           | chefandy wrote:
           | What computationally complex operation would a forum
           | application regularly do? I can't think of any but I've never
           | written a forum application.
        
             | layer8 wrote:
             | Figuring out which posts to display on page 853 in threaded
             | view.
        
             | jacquesm wrote:
             | Database joins for instance. Ranking articles.
        
               | jbm wrote:
               | Wouldn't these happen in the DB?
               | 
               | I can see some algorithms for showing related articles
               | being complex -- but writing them in Assembly also
               | invites other challenges (them being difficult to update
               | and improve, concentrating on memory issues rather than
               | algorithm, etc...).
               | 
               | I still think it's a cool project mind you.
        
               | jacquesm wrote:
               | Keeping any assembly codebase up and running, especially
               | through changes in requirements is a massive challenge,
               | requires extreme hygiene and will be very, very costly.
               | 
               | My largest assembly projects were around the 16K object
               | code mark (the size of the largest EPROM) and I hope to
               | never ever have to do stuff like that again. But the kind
               | of performance you can get out of very modest hardware is
               | amazing.
        
               | 10000truths wrote:
               | The DB in this case is SQLite, which is embedded.
        
       | Chiba-City wrote:
       | [dead]
        
       | jacquesm wrote:
       | Imagine what you could do with a smartphone if it were programmed
       | entirely in assembly.
        
         | jodrellblank wrote:
         | You could make a device that was slower than Window CE and go
         | bankrupt! https://news.ycombinator.com/item?id=36570062
        
           | jacquesm wrote:
           | Yes, you could do that too. But you wouldn't have to.
        
         | wyldfire wrote:
         | Weird. I just tried it and it seems to be bootlooping now.
         | 
         | Hmm. maybe there's a bug in one of the lines of someone's code.
         | 
         | Guess I better get started investigating it. 'Cause once I'm
         | done I've got to start porting it to RISC-V.
        
         | xigency wrote:
         | I'm sure it would be very fast at booting and fast at crashing
         | as well. However, on the Android side it's probably what's
         | needed to compete with Apple hardware and software.
        
         | simulosius wrote:
         | Why would anyone want to program a smartphone entirely in
         | assembly?
         | 
         | There is a reason (well actually there are many) that the vast
         | majority of software development these days is done using more
         | advanced languages.
        
           | jacquesm wrote:
           | Cost. Convenience. In that order.
        
             | simulosius wrote:
             | Cost? Please explain why writing programs in assembly is
             | supposed to be *cheaper* than writing programs in a higher
             | level language? The same goes for convenience: Since when
             | is writing an application in assemlby more convenient than
             | writing an application in a modern language?
        
               | jacquesm wrote:
               | No, it is more expensive. And _less_ convenient. For some
               | reason you interpreted both of these the wrong way
               | around. I wasn 't answering the question, I was giving
               | examples of those reasons. Which are pretty obvious.
        
               | simulosius wrote:
               | Ah sorry, my bad! Makes a lot more sense this way ;-)
        
               | jacquesm wrote:
               | It certainly does :) I should have quoted that bit though
               | to make it clearer.
        
         | kwhitefoot wrote:
         | Why would you be able to do more, or indeed less, with it
         | programmed in assembly rather than a higher level language?
         | 
         | There isn't anything about assembly language that makes it
         | inherently more effective or efficient than a high level
         | language.
        
           | rahen wrote:
           | In principle, this amounts to giving a gift to society: the
           | programmer spends more time on their work so that society as
           | a whole consumes fewer resources. Often, the opposite
           | happens: the programmer transfers their productivity gain
           | into an additional cost for society (usually by contributing
           | to e-waste and added resource requirements).
           | 
           | It's easy to extrapolate this to other domains. Imagine that
           | in order to enhance their productivity, aerospace engineers
           | started buying off-the-shelf generic components and get them
           | assembled as quickly as possible without seeking
           | optimization. The airplanes will consume a lot more fuel,
           | have a worse safety record and require constant upgrades and
           | maintenance, but it doesn't matter much as the manufacturer
           | can now hire fewer engineers, and it's other people's fuel
           | you're wasting anyway.
           | 
           | I understand that seeking immediate profit is the norm, but
           | I'm always a little disillusioned when I see selfless
           | initiatives ridiculed.
        
           | jacquesm wrote:
           | Your executables will be a small fraction of the size that
           | you expect, you will likely be able to fit the whole thing in
           | cache and you will consume less power because you will be
           | happy with a smaller cycles budget so you can run the cpu
           | much slower.
           | 
           | Of course this all comes at a price: decreased programmer
           | efficiency.
        
             | rafram wrote:
             | I don't think that's actually true. Compilers write machine
             | code that's often much more efficient than anything you
             | could think up by hand, and the bulk of the disk
             | space/memory used by a modern executable is for
             | resources/strings, not instructions. Stereotypical assembly
             | code - extremely lean routines that accept minimal user
             | input and don't create human-readable output - is indeed
             | smaller than a stereotypical compiled executable, but you'd
             | have trouble beating the compiler 1:1 on the same problem.
        
               | jacquesm wrote:
               | But you won't be writing the same code as the code that
               | you would write in a high level language, and that is
               | sort of the point. You're going to do your utmost _not_
               | to write such code because then you might as well break
               | out the C compiler.
        
               | rahen wrote:
               | I don't think so, modern high level languages tend to be
               | linked to huge runtimes that are usually load entirely in
               | memory. Assembly programs don't.
        
             | kwhitefoot wrote:
             | > Your executables will be a small fraction of the size
             | that you expect,
             | 
             | No they won't. There is no way that you can write more
             | compact code than a modern optimizing compiler for anything
             | except the most extreme edge cases.
        
               | jacquesm wrote:
               | Yes you will. Because you can't afford to write code like
               | a modern optimizing compiler. You're going to have the
               | same kind of linecount that you have in your high level
               | language projects and those lines will compile down to a
               | few bytes each at most.
               | 
               | Assembly language binaries tend to be extremely small
               | compared to equivalent code written using a high level
               | language. But: you'll easily spend 10x the time on them.
               | The 'modern optimizing compiler' argument is at the
               | function level: where you write a function using assembly
               | and then write a similar function using a high level
               | language (but still a compiled one, obviously). Yes, the
               | compiler will probably win that race. But an assembly
               | language programmer isn't going to write their code like
               | that at all.
               | 
               | They will reduce the task to the point where it is
               | manageable and that alone will save far more code than
               | the compiler can ever remove. Assembly is (and assembly
               | language based applications are) utterly bloat free, you
               | do what you have to do and nothing more. You can use
               | registers in ways that a compiler would never even think
               | of because you can _globally_ optimize.
               | 
               | No stack frames if you don't need them. No memory
               | accesses if you don't need them.
               | 
               | But code that is hard to maintain and that likely will
               | not be easy to work on with multiple people. 100 KLOC
               | (including comments) -> 16Kb output. No high level
               | language would even begin to approach that.
        
               | mjan22640 wrote:
               | I remember claims that compilers are going to emit better
               | machine code than humans when pipelined and speculative
               | execution was first implemented in intel processors. It
               | turned out to not be true. It is still not true as of
               | today. Humans are still better at this, and still by
               | humongous margin. LLMs are going to change that soon
               | however.
        
               | charsii wrote:
               | It's trivially easy.
               | 
               | One low hanging fruit: Compilers are handicapped by ABIs
               | and language semantics, they must adhere to calling
               | conventions, alignments, paddings, exceptions/stack
               | unwinding, etc.
               | 
               | If you don't have to care about any of that you can save
               | a lot of useless instructions.
               | 
               | And secondly when it comes to size optimizations,
               | compilers are pretty bad (or they tend to still value
               | some speed over pure size). Wont find any modern compiler
               | emitting lodsb/stosb (the non-rep kind) on x86 for
               | example.
        
         | petabytes wrote:
         | Kolibri OS was written entirely in Assembly. I think the
         | performance was pretty poor compared to C operating systems.
         | Much easier to write optimized algorithms in high level
         | languages. https://kolibrios.org/en/
        
         | HeckFeck wrote:
         | Didn't we have something similar to that with the early DOS-
         | based palmtop PCs?
        
         | cultofmetatron wrote:
         | assembly? the current standard is kotlin or swift which while
         | reasonably performant, leave a lot on the table. i'd love to
         | have first class support for writing android and ios
         | applications in rust. plenty fast enough for me. my day job is
         | elixir but the memory requirements are a bit high for mobile
         | apps (though I'm sure the guys at nerves would disagree)
        
       | mcint wrote:
       | Real-time notifications give a sense of activity, nice for
       | building a community. Reminds me of http://listen.hatnote.com/
       | showing live wikipedia edits, but more integrated. Some
       | anonymity, or mention of a group, e.g. anonymous users, forum
       | member, admin, would be better. Too much and too specific sharing
       | of activity makes this feel stifling--more like chat with read
       | notifications, less like email or forum where people take time to
       | compose replies.
        
       | xigency wrote:
       | [flagged]
        
         | fasterik wrote:
         | [flagged]
        
       | skilled wrote:
       | All I want for Christmas is the old-school :lol: emoji from phpBB
       | days...
        
       | Jyaif wrote:
       | Very fast! Or should I say, the normal speed at which websites
       | should operate.
       | 
       | x86 only.
        
       ___________________________________________________________________
       (page generated 2023-08-27 23:00 UTC)