Comment by jart

4 years ago

I'm not sure what code size has to do with networking and multitasking. Size coding requires technique and caring about size. In the case of hash.c it's likely because the hash function has unrolled loops and is being inlined into all the functions that use it. It'd also reduce size a lot if a loop were used to iterate over the names and function pointers during initialization. I normally gain an intuition for these kinds of things because I have a keyboard shortcut that shows me the assembly of whatever code I'm writing, but I had to implement that feature into my editor myself, so I'm not sure how many other people do that. Bloat also isn't a mandatory price of the modern age we love. For instance, languages exist for 64-bit architecture that have binaries less than 400 bytes in size.

> For instance, languages exist for 64-bit architecture that have binaries less than 400 bytes in size.

In V (https://github.com/vlang/v/) for example, with the currently experimental native backend, you can produce executables, that are < 400 bytes:

    $ cat examples/hello_world.v
    println('Hello, World!')
    $ ./v -b native -o hw examples/hello_world.v
    $ ls -l hw
    -rwxrwxr-x 1 delian delian 183 Mar 13 17:51 hw
    $ ./hw
    Hello, World!