It occurred to me when I was browsing threads here that there is an immense collection of simple and extremely space-efficient functions on this site.

Although I imagine the end result of such an endeavor would be a complete bastardization of best-practices regarding readability and maintainability, it might be useful to people working with resource limited microsystems.

Maybe we're past the point of something like this being of much use given the ever decreasing size and cost of storage and usually poor performance metrics of many golfed solutions.

Have there been any large-scale attempts to assemble libraries or more complex programs almost exclusively from aggressively-golfed solutions in a given language?

  • 1
    \$\begingroup\$ Extremely space efficient?! Is this a joke :P (oh they probably meant literal code size not space as in space complexity) \$\endgroup\$
    – rak1507
    Commented Sep 16, 2021 at 13:38
  • 1
    \$\begingroup\$ @rak1507 Given that that's the whole point of the site, there are a lot of those here :p (oh I just noticed your edit) \$\endgroup\$ Commented Sep 16, 2021 at 13:39
  • \$\begingroup\$ What exactly are we talking about here? Many golfed pieces of code that can be found on this site would still require huge binaries for a standalone use, e.g. a full Python environment + the Jelly interpreter + a few bytes for the actual Jelly code. Also, many algorithms used in golfed code would put any resource limited microsystem on its knees because they tend to require unreasonable amounts of RAM and CPU cycles, just to save a few bytes of code. \$\endgroup\$
    – Arnauld
    Commented Sep 16, 2021 at 17:26
  • 2
    \$\begingroup\$ From time to time, however, some golfing tricks (such as bitwise black magic) are actually both short and efficient. So maybe that's the kind of things you're looking for? \$\endgroup\$
    – Arnauld
    Commented Sep 16, 2021 at 17:35

1 Answer 1


To my knowledge, reducing code size has two main uses in real world: microsystems (as you mentioned) and JS in the browser.

For microsystems, the objective is to create small machine code (say x86, ARM, z80, ...). While I don't know of any kind of "library" (in the sense that you can link your code to it like a C library) and I guess it is not quite possible in general, Sizecoding wiki has a good amount of tips and resources for various architectures, including some large collections of well-golfed programs.

On the other hand, JS code is usually minimized to reduce network load and improve browser-side loading time. Again, there are no specific libraries of golfed JS code, but for a different reason: production JS code usually goes through an automated minifier. (That's why you see all those whatever.min.js files on the Internet.)

For (at least partially) hand-minimized real JS programs and resources, you might want to check out size-constrained events such as JS1k (2010-2019) and JS13Kgames (2012-2021, ongoing), and especially resources for JS13Kgames.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .