This commit is contained in:
Miloslav Ciz 2024-02-10 12:19:55 +01:00
parent 9d1876387b
commit be97db7fc4
24 changed files with 1754 additions and 1683 deletions

View file

@ -14,7 +14,7 @@ A very important realization of a graphics programmer is that **3D rendering is
**Rendering spectrum**: The book *Real-Time Rendering* mentions that methods for 3D rendering can be seen as lying on a spectrum, one extreme of which is *appearance reproduction* and the other *physics simulation*. Methods closer to trying to imitate the appearance try to simply focus on imitating the look of an object on the monitor that the actual 3D object would have in real life, without being concerned with *how* that look arises in real life (i.e. closer to the "faking" approach mentioned above) -- these may e.g. use image data such as photographs; these methods may rely on lightfields, photo [textures](texture.md) etc. The physics simulation methods try to replicate the behavior of light in real life -- their main goal is to solve the **[rendering equation](rendering_equation.md)**, still only more or less [approximately](approximation.md) -- and so, through internally imitating the same processes, come to similar visual results that arise in real world: these methods rely on creating 3D geometry (e.g. that made of triangles or voxels), computing light reflections and [global illumination](global_illumination.md). This is often easier to program but more computationally demanding. Most methods lie somewhere in between these two extremes: for example [billboards](billboard.md) and [particle systems](particle_system.md) may use a texture to represent an object while at the same time using 3D quads (very simple 3D models) to correctly deform the textures by perspective and solve their visibility. The classic polygonal 3D models are also usually somewhere in between: the 3D geometry and [shading](shading.md) are trying to simulate the physics, but e.g. a photo texture mapped on such 3D model is the opposite appearance-based approach ([PBR](pbr.md) further tries to shift the use of textures more towards the *physics simulation* end). **Rendering spectrum**: The book *Real-Time Rendering* mentions that methods for 3D rendering can be seen as lying on a spectrum, one extreme of which is *appearance reproduction* and the other *physics simulation*. Methods closer to trying to imitate the appearance try to simply focus on imitating the look of an object on the monitor that the actual 3D object would have in real life, without being concerned with *how* that look arises in real life (i.e. closer to the "faking" approach mentioned above) -- these may e.g. use image data such as photographs; these methods may rely on lightfields, photo [textures](texture.md) etc. The physics simulation methods try to replicate the behavior of light in real life -- their main goal is to solve the **[rendering equation](rendering_equation.md)**, still only more or less [approximately](approximation.md) -- and so, through internally imitating the same processes, come to similar visual results that arise in real world: these methods rely on creating 3D geometry (e.g. that made of triangles or voxels), computing light reflections and [global illumination](global_illumination.md). This is often easier to program but more computationally demanding. Most methods lie somewhere in between these two extremes: for example [billboards](billboard.md) and [particle systems](particle_system.md) may use a texture to represent an object while at the same time using 3D quads (very simple 3D models) to correctly deform the textures by perspective and solve their visibility. The classic polygonal 3D models are also usually somewhere in between: the 3D geometry and [shading](shading.md) are trying to simulate the physics, but e.g. a photo texture mapped on such 3D model is the opposite appearance-based approach ([PBR](pbr.md) further tries to shift the use of textures more towards the *physics simulation* end).
With this said, let's not take a look at possible **classifications** of 3D rendering methods. As seen, there are many ways: With this said, let's now take a look at possible **classifications** of 3D rendering methods. As seen, there are many ways:
- by **order**: - by **order**:
- **object order**: The method iterates on objects and draws object by object, one after another. This results in pixels being drawn to "random" places on the screen and possibly already drawn pixels being [overdrawn](overdraw.md) with new pixels (though this can be further reduced). Typically requires a [frame buffer](frame_buffer.md) and [double buffering](double_buffering.md), often also [z-buffer](z_buffer.md) (or [sorting](sorting.md)), i.e. requires a lot of memory. This method is also a bit ugly but typically also faster than the alternative, so it is prevailing nowadays. - **object order**: The method iterates on objects and draws object by object, one after another. This results in pixels being drawn to "random" places on the screen and possibly already drawn pixels being [overdrawn](overdraw.md) with new pixels (though this can be further reduced). Typically requires a [frame buffer](frame_buffer.md) and [double buffering](double_buffering.md), often also [z-buffer](z_buffer.md) (or [sorting](sorting.md)), i.e. requires a lot of memory. This method is also a bit ugly but typically also faster than the alternative, so it is prevailing nowadays.
@ -98,7 +98,7 @@ TODO: VoxelQuest has some innovative voxel rendering, check it out (https://www.
## 3D Rendering Basics For Nubs ## 3D Rendering Basics For Nubs
If you're a complete noob and are asking what the essence of 3D is or just how to render simple 3Dish pictures for your game without needing a [PhD](phd.md), here's the very basics. Yes, you can use some 3D engine such as [Godot](godot.md) that has all the 3D rendering preprogrammed, but you you'll surrender to [bloat](bloat.md), you won't really know what's going on and your ability to tinker with the rendering or optimizing it will be basically zero... AND you'll miss on all the [fun](fun.md) :) So here we just foreshadow some concepts you should start with if you want to program your own 3D rendering. If you're a complete noob and are asking what the essence of 3D is or just how to render simple 3Dish pictures for your game without needing a [PhD](phd.md), here's the very basics. Yes, you can use some 3D engine such as [Godot](godot.md) that has all the 3D rendering preprogrammed, but you'll surrender to [bloat](bloat.md), you won't really know what's going on and your ability to tinker with the rendering or optimizing it will be basically zero... AND you'll miss on all the [fun](fun.md) :) So here we just foreshadow some concepts you should start with if you want to program your own 3D rendering.
The absolute basic thing in 3D is probably **[perspective](perspective.md)**, or the concept which says that "things further away look smaller". This is basically the number one thing you need to know and with which you can make simple 3D pictures, even though there are many more effects and concepts that "make pictures look 3D" and which you can potentially study later (lighting, shadows, [focus and blur](depth_of_field.md), [stereoscopy](stereo.md), [parallax](parallax.md), visibility/obstruction etc.). { It's probably possible to make something akin "3D" even without perspective, just with [orthographic](ortho.md) projection, but that's just getting to details now. Let's just suppose we need perspective. ~drummyfish } The absolute basic thing in 3D is probably **[perspective](perspective.md)**, or the concept which says that "things further away look smaller". This is basically the number one thing you need to know and with which you can make simple 3D pictures, even though there are many more effects and concepts that "make pictures look 3D" and which you can potentially study later (lighting, shadows, [focus and blur](depth_of_field.md), [stereoscopy](stereo.md), [parallax](parallax.md), visibility/obstruction etc.). { It's probably possible to make something akin "3D" even without perspective, just with [orthographic](ortho.md) projection, but that's just getting to details now. Let's just suppose we need perspective. ~drummyfish }

View file

@ -4,7 +4,7 @@ Assembly (also ASM) is, for any given hardware computing platform ([ISA](isa.md)
**Assembly is NOT a single language**, it differs for every architecture, i.e. every model of CPU has potentially different architecture, understands a different machine code and hence has a different assembly (though there are some standardized families of assembly like x86 that work on wide range of CPUs); therefore **assembly is not [portable](portability.md)** (i.e. the program won't generally work on a different type of CPU or under a different [OS](os.md))! And even the same kind of assembly language may have several different [syntax](syntax.md) formats which may differ in comment style, order of writing arguments and even instruction abbreviations (e.g. x86 can be written in [Intel](intel.md) and [AT&T](at_and_t.md) syntax). For the reason of non-portability (and also for the fact that "assembly is hard") you shouldn't write your programs directly in assembly but rather in a bit higher level language such as [C](c.md) (which can be compiled to any CPU's assembly). However you should know at least the very basics of programming in assembly as a good programmer will come in contact with it sometimes, for example during hardcore [optimization](optimization.md) (many languages offer an option to embed inline assembly in specific places), debugging, reverse engineering, when writing a C compiler for a completely new platform or even when designing one's own new platform. **You should write at least one program in assembly** -- it gives you a great insight into how a computer actually works and you'll get a better idea of how your high level programs translate to machine code (which may help you write better [optimized](optimization.md) code) and WHY your high level language looks the way it does. **Assembly is NOT a single language**, it differs for every architecture, i.e. every model of CPU has potentially different architecture, understands a different machine code and hence has a different assembly (though there are some standardized families of assembly like x86 that work on wide range of CPUs); therefore **assembly is not [portable](portability.md)** (i.e. the program won't generally work on a different type of CPU or under a different [OS](os.md))! And even the same kind of assembly language may have several different [syntax](syntax.md) formats which may differ in comment style, order of writing arguments and even instruction abbreviations (e.g. x86 can be written in [Intel](intel.md) and [AT&T](at_and_t.md) syntax). For the reason of non-portability (and also for the fact that "assembly is hard") you shouldn't write your programs directly in assembly but rather in a bit higher level language such as [C](c.md) (which can be compiled to any CPU's assembly). However you should know at least the very basics of programming in assembly as a good programmer will come in contact with it sometimes, for example during hardcore [optimization](optimization.md) (many languages offer an option to embed inline assembly in specific places), debugging, reverse engineering, when writing a C compiler for a completely new platform or even when designing one's own new platform. **You should write at least one program in assembly** -- it gives you a great insight into how a computer actually works and you'll get a better idea of how your high level programs translate to machine code (which may help you write better [optimized](optimization.md) code) and WHY your high level language looks the way it does.
**OK, but why doesn't anyone make a portable assembly?** Well, people do, they just usually call it a [bytecode](bytecode.md) -- take a look at that. [C](c.md) is portable and low level, so it is often called a "portable assembly", though it still IS significantly higher in abstraction and won't usually give you the real assembly vibes. [Forth](forth.md) may also be seen as close to such concept. ACTUALLY [Dusk OS](duskos.md) has something yet closer, called [Harmonized Assembly Layer](hal.md) (see https://git.sr.ht/~vdupras/duskos/tree/master/fs/doc/hal.txt). **OK, but why doesn't anyone make a portable assembly?** Well, people do, they just usually call it a [bytecode](bytecode.md) -- take a look at that. [C](c.md) is portable and low level, so it is often called a "portable assembly", though it still IS significantly higher in abstraction and won't usually give you the real assembly vibes. [Forth](forth.md) may also be seen as close to such concept. ACTUALLY [Dusk OS](duskos.md) has something yet closer, called [Harmonized Assembly Layer](hal.md) (see https://git.sr.ht/~vdupras/duskos/tree/master/fs/doc/hal.txt). [Web assembly](web_assembly.md) would also probably fit the definition.
The most common assembly languages you'll encounter nowadays are **[x86](x86.md)** (used by most desktop [CPUs](cpu.md)) and **[ARM](arm.md)** (used by most mobile CPUs) -- both are used by [proprietary](proprietary.md) hardware and though an assembly language itself cannot (as of yet) be [copyrighted](copyright.md), the associated architectures may be "protected" (restricted) e.g. by [patents](patent.md) (see also [IP cores](ip_core.md)). **[RISC-V](risc_v.md)** on the other hand is an "[open](open.md)" alternative, though not yet so wide spread. Other assembly languages include e.g. [AVR](avr.md) (8bit CPUs used e.g. by some [Arduinos](arduino.md)) and [PowerPC](ppc.md). The most common assembly languages you'll encounter nowadays are **[x86](x86.md)** (used by most desktop [CPUs](cpu.md)) and **[ARM](arm.md)** (used by most mobile CPUs) -- both are used by [proprietary](proprietary.md) hardware and though an assembly language itself cannot (as of yet) be [copyrighted](copyright.md), the associated architectures may be "protected" (restricted) e.g. by [patents](patent.md) (see also [IP cores](ip_core.md)). **[RISC-V](risc_v.md)** on the other hand is an "[open](open.md)" alternative, though not yet so wide spread. Other assembly languages include e.g. [AVR](avr.md) (8bit CPUs used e.g. by some [Arduinos](arduino.md)) and [PowerPC](ppc.md).

View file

@ -274,4 +274,6 @@ And the bytecode we get (e.g. with `python -m dis program.py`):
87 RETURN_VALUE 87 RETURN_VALUE
``` ```
TODO: make sense of it and analyze it TODO: make sense of it and analyze it
TODO: web assembly

View file

@ -2,7 +2,7 @@
*"When copying is outlawed, only outlaws will have culture."* --[Question Copyright website](https://questioncopyright.org/) *"When copying is outlawed, only outlaws will have culture."* --[Question Copyright website](https://questioncopyright.org/)
Copyright (better called *copyrestriction* or *copywrong*) is one of many types of so called "[intellectual property](intellectual_property.md)" (IP), a legal concept that allows "ownership", i.e. restriction, [censorship](censorship.md) and artificial [monopoly](monopoly.md) on certain kinds of [information](information.md), for example prohibition of sharing or viewing useful [information](information.md) or improving [art](art.md) works. Copyright specifically allows the copyright holder (not necessarily the author) a monopoly (practically absolute power) over [art](art.md) creations such as images, songs or texts, which also include source code of computer [programs](program.md). Copyright is a [capitalist](capitalism.md) mechanism for creating [artificial scarcity](artificial_scarcity.md), enabling censorship and elimination of the [public domain](public_domain.md) (a pool of freely shared works that anyone can use and benefit from). Copyright is not to be confused with [trademarks](trademark.md), [patents](patent.md) and other kinds of "intellectual property", which are similarly [harmful](harmful.md) but legally different. Copyright is symbolized by C in a circle or in brackets: (C), which is often accompanies by the phrase "all rights reserved". Copyright (better called *copyrestriction*, *copyrape* or *copywrong*) is one of many types of so called "[intellectual property](intellectual_property.md)" (IP), a legal concept that allows "ownership", i.e. restriction, [censorship](censorship.md) and artificial [monopoly](monopoly.md) on certain kinds of [information](information.md), for example prohibition of sharing or viewing useful [information](information.md) or improving [art](art.md) works. Copyright specifically allows the copyright holder (not necessarily the author) a monopoly (practically absolute power) over [art](art.md) creations such as images, songs or texts, which also include source code of computer [programs](program.md). Copyright is a [capitalist](capitalism.md) mechanism for creating [artificial scarcity](artificial_scarcity.md), enabling censorship and elimination of the [public domain](public_domain.md) (a pool of freely shared works that anyone can use and benefit from). Copyright is not to be confused with [trademarks](trademark.md), [patents](patent.md) and other kinds of "intellectual property", which are similarly [harmful](harmful.md) but legally different. Copyright is symbolized by C in a circle or in brackets: (C), which is often accompanies by the phrase "all rights reserved".
When someone creates something that can even remotely be considered artistic expression (even such things as e.g. a mere collection of already existing things), he automatically gains copyright on it, without having to register it, pay any tax, announce it or let it be known anywhere in any way. He then practically has a full control over the work and can successfully sue anyone who basically just touches the work in any way (even unknowingly and unintentionally). Therefore **any work (such as computer code) without a [free](free_software.md) license attached is implicitly fully "owned" by its creator** (so called "all rights reserved") and can't be used by anyone without permission. It is said that copyright can't apply to ideas (ideas are covered by [patents](patent.md)), only to expressions of ideas, however that's [bullshit](bs.md), the line isn't clear and is arbitrarily drawn by judges; for example regarding stories in books it's been established that the story itself can be copyrighted, not just its expression (e.g. you can't rewrite the [Harry Potter](harry_potter.md) story in different words and start selling it). When someone creates something that can even remotely be considered artistic expression (even such things as e.g. a mere collection of already existing things), he automatically gains copyright on it, without having to register it, pay any tax, announce it or let it be known anywhere in any way. He then practically has a full control over the work and can successfully sue anyone who basically just touches the work in any way (even unknowingly and unintentionally). Therefore **any work (such as computer code) without a [free](free_software.md) license attached is implicitly fully "owned" by its creator** (so called "all rights reserved") and can't be used by anyone without permission. It is said that copyright can't apply to ideas (ideas are covered by [patents](patent.md)), only to expressions of ideas, however that's [bullshit](bs.md), the line isn't clear and is arbitrarily drawn by judges; for example regarding stories in books it's been established that the story itself can be copyrighted, not just its expression (e.g. you can't rewrite the [Harry Potter](harry_potter.md) story in different words and start selling it).

2
cpu.md
View file

@ -52,6 +52,8 @@ Here are listed some notable CPUs (or sometimes CPU families or cores).
{ I'm not so great with HW, suggest me improvements for this section please, thanks <3 ~drummyfish } { I'm not so great with HW, suggest me improvements for this section please, thanks <3 ~drummyfish }
{ WTF, allthetropes has quite a big list of famous CPUs, isn't it a site about movies? https://allthetropes.org/wiki/Central_Processing_Unit. ~drummyfish }
TODO: add more, mark CPUs with ME, add features like MMX, FPU, ... TODO: add more, mark CPUs with ME, add features like MMX, FPU, ...
| CPU |year |bits (/a)| ISA |~tr. c.|tr. size | freq. | pins |cores| other | notes | | CPU |year |bits (/a)| ISA |~tr. c.|tr. size | freq. | pins |cores| other | notes |

View file

@ -17,6 +17,8 @@ Debugging programs mostly happens in these steps:
3. **Locating it**: now as you have a crashing program, you examine it and find WHY exactly it crashes, which line of code causes the crash etc. 3. **Locating it**: now as you have a crashing program, you examine it and find WHY exactly it crashes, which line of code causes the crash etc.
4. **Fixing it**: now as you know why and where the bug exists, you just make it go away. Sometimes a [hotfix](hotfix.md) is quickly applied before implementing a proper fix. 4. **Fixing it**: now as you know why and where the bug exists, you just make it go away. Sometimes a [hotfix](hotfix.md) is quickly applied before implementing a proper fix.
For debugging your program it may greatly help to make **debugging builds** -- you may pass flags to your compiler that make the program better for debugging, e.g. with [gcc](gcc.md) you will likely want to use `-g` (generate debug symbols) and `-Og` (optimize for debugging) flags. Without this debuggers will still work but may be e.g. unable to tell you the name of function inside which the program crashed etc.
The following are some of the most common methods used to debug software, roughly in order by which one typically applies them in practice. The following are some of the most common methods used to debug software, roughly in order by which one typically applies them in practice.
### Testing ### Testing

View file

@ -6,23 +6,28 @@ The motivation behind creating fantasy consoles is normally twofold: firstly the
Fantasy consoles usually include some kind of simple [IDE](ide.md); a typical mainstream fantasy console both runs and is programmed in a [web browser](browser.md) so as to be accessible to normies. They also use some kind of easy scripting language for game programming, e.g. [Lua](lua.md). Even though the games are simple, the code of such a mainstream console is normally [bloat](bloat.md), i.e. we are talking about **[pseudominimalism](pseudominimalism.md)**. Nevertheless some consoles, such as [SAF](saf.md), are truly [suckless](suckless.md), free and highly portable (it's not a coincidence that SAF is an official [LRS](lrs.md) project). Fantasy consoles usually include some kind of simple [IDE](ide.md); a typical mainstream fantasy console both runs and is programmed in a [web browser](browser.md) so as to be accessible to normies. They also use some kind of easy scripting language for game programming, e.g. [Lua](lua.md). Even though the games are simple, the code of such a mainstream console is normally [bloat](bloat.md), i.e. we are talking about **[pseudominimalism](pseudominimalism.md)**. Nevertheless some consoles, such as [SAF](saf.md), are truly [suckless](suckless.md), free and highly portable (it's not a coincidence that SAF is an official [LRS](lrs.md) project).
Some fantasy consoles may blend with [open consoles](open_console.md), e.g. by starting as a virtual console that's later implemented in real hardware.
## Notable Fantasy Consoles ## Notable Fantasy Consoles
The following are a few notable fantasy consoles. The following are a few notable fantasy consoles.
| name | license | game lang. | specs. | comment | | name | year | license | game lang. | specs. | comment |
| ------------------- | ----------------------- | ----------------- | ------------------- | -------------------------------- | | --------------------- | ---- | ----------------------- | ----------------- | ------------------- | -------------------------------- |
|[CToy](ctoy.md) |[zlib](zlib.md) | [C](c.md) |128x128 |[suckless](suckless.md) | |[CToy](ctoy.md) | 2016 | [zlib](zlib.md) | [C](c.md) |128x128 |[suckless](suckless.md) |
|[IBNIZ](ibniz.md) |[zlib](zlib.md) | own |256x256 32b, 4M RAM |for demos, by [Viznut](viznut.md) | |[IBNIZ](ibniz.md) | 2011 | [zlib](zlib.md) | own |256x256 32b, 4M RAM |for demos, by [Viznut](viznut.md) |
|[LIKO-12](liko12.md) |[MIT](mit.md) | [Lua](lua.md) |192x128 | | |[LIKO-12](liko12.md) | 2016 | [MIT](mit.md) | [Lua](lua.md) |192x128 | |
|[microw8](microw8.md)|[unlicense](unlicense.md)| webassembly |320x240 8b, 256K RAM | | |[MEG4](meg4.md) | 2023 | [GPL](gpl.md) | C, Lua, ... |320x200 8b, 576K RAM | |
|[PICO-8](pico8.md) |[propr.](proprietary.md) | [Lua](lua.md) |128x128 4b |likely most famous | |[microw8](microw8.md) | 2021 |[unlicense](unlicense.md)| webassembly |320x240 8b, 256K RAM | |
|PixelVision8 |[MS-PL](ms_pl.md) (FOSS) | [Lua](lua.md) |256x240 |written in C# | |[PICO-8](pico8.md) | 2015 |[propr.](proprietary.md) | [Lua](lua.md) |128x128 4b |likely most famous |
|Pyxel |[MIT](mit.md) |[Python](python.md)|256x256 4b | | |PixelVision8 | 2020 |[MS-PL](ms_pl.md) (FOSS) | [Lua](lua.md) |256x240 |written in C# |
|[SAF](saf.md) |[CC0](cc0.md) | [C](c.md) |64x64 8b |[LRS](lrs.md), suckless | |Pyxel | 2018 | [MIT](mit.md) |[Python](python.md)|256x256 4b | |
|[TIC-80](tic80.md) |[MIT](mit.md) | Lua, JS, ... |240x136 4b |paid "pro" version | |[SAF](saf.md) | 2021 | [CC0](cc0.md) | [C](c.md) |64x64 8b |[LRS](lrs.md), suckless |
|[uxn](uxn.md) |[MIT](mit.md) | [Tal](tal.md) | |very minimal | |[TIC-80](tic80.md) | 2016 | [MIT](mit.md) | Lua, JS, ... |240x136 4b |paid "pro" version |
|[wasm4](wasm4.md) |[ISC](isc.md) | webassembly |160x160, 64K RAM | | |[Vircon32](vircon32.md)| | ??? | C, assembly |640x360, 16M RAM |aims to be implementable in HW |
|[uxn](uxn.md) | 2021 | [MIT](mit.md) | [Tal](tal.md) | |very minimal |
Apart from these there are many more (MicroW8, PX8, WASM-4, ZZT, ...), you can find lists such as https://paladin-t.github.io/fantasy/index. There even exists a [Brainfuck](brainfuck.md) fantasy console, called BrainFuckConsole74.
## See Also ## See Also
@ -32,4 +37,4 @@ The following are a few notable fantasy consoles.
- [IBNIZ](ibniz.md) - [IBNIZ](ibniz.md)
- [ISA](isa.md) - [ISA](isa.md)
- [SAF](saf.md) - [SAF](saf.md)
- [DOS](dos.md) - [DOS](dos.md)

View file

@ -1,7 +1,7 @@
# Good Enough # Good Enough
A good enough solution to a problem is a solution that solves the problem satisfyingly (not necessarily precisely or completely) while achieving minimal cost (effort, implementation time etc.). This is in contrast to looking for a better solutions for a higher cost, which we might call an [overkill](overkill.md). For example a word-for-word translation of a text is a primitive way of translation, but it may be good enough to understand the meaning of the text; in many climates a tent is a good enough accommodation solution while a luxury house is a solution of better quality (more comfortable, safe, ...) for a higher cost. A good enough solution to a problem is a solution that solves the problem satisfyingly (not necessarily precisely or completely) while achieving minimal cost (effort, complexity, [maintenance](maintenance.md), implementation time etc.). This is contrasted with an [overkill](overkill.md), a solution that's "too good" (for a higher cost). For example a word-for-word translation of a text is a primitive way of translation, but it may be good enough to understand the meaning of the text; in many climates a tent is a good enough accommodation solution while a luxury house is a solution of better quality (more comfortable, safe, ...) for a higher cost.
To give an example from the world of programming, [bubble sort](bubble_sort.md) is in many cases better than quick sort for its simplicity, even though it's much slower than more advanced sorts. To give an example from the world of programming, [bubble sort](bubble_sort.md) is in many cases better than quick sort for its simplicity, even though it's much slower than more advanced sorts. [ASCII](ascii.md) is mostly good enough compared to [Unicode](unicode.md). And so on.
In technology we are often times looking for good enough solution to achieve [minimalism](minimalism.md) and save valuable resources (computational resources, programmer time etc.). It rarely makes sense to look for solutions that are more expensive than they necessarily need to be, however in the context of [capitalist software](capitalist_software.md) we see this happen many times as a part of killer feature battle and also driving prices artificially up for economic reasons (e.g. increasing the cost of maintenance of a software eliminates any competition that can't afford such cost). An example of this is the trend in smartphones to have 4 and more physical cameras. This is only natural in [capitalism](capitalism.md), we see the tendency for wasting resources everywhere. This of course needs to be stopped. In technology we are often times looking for good enough solution to achieve [minimalism](minimalism.md) and save valuable resources (computational resources, programmer time etc.). It rarely makes sense to look for solutions that are more expensive than they necessarily need to be, however in the context of [capitalist software](capitalist_software.md) we see this happen many times as a part of killer feature battle and also driving prices artificially up for economic reasons (e.g. increasing the cost of maintenance of a software eliminates any competition that can't afford such cost). An example of this is the trend in smartphones to have 4 and more physical cameras. This is only natural in [capitalism](capitalism.md), we see the tendency for wasting resources everywhere. This of course needs to be stopped.

View file

@ -23,4 +23,5 @@ WATCH OUT: **infinite universe doesn't imply existence of everything** -- this i
## See Also ## See Also
- [zero](zero.md)
- [thrembo](thrembo.md) - [thrembo](thrembo.md)

View file

@ -100,6 +100,23 @@ For the next phase education is crucial, we have to spread our ideas further, fi
With this more of the common people should start to jump on the train and support causes such as [universal basic income](ubi.md), [free software](free_software.md) etc., possibly leading to establishment of communities and political parties that will start restricting capitalism and implementing a more socialist society with more freedom and better education, which should further help nurture people better and accelerate the process further. From here on things should become much easier and faster, people will already see the right direction themselves. With this more of the common people should start to jump on the train and support causes such as [universal basic income](ubi.md), [free software](free_software.md) etc., possibly leading to establishment of communities and political parties that will start restricting capitalism and implementing a more socialist society with more freedom and better education, which should further help nurture people better and accelerate the process further. From here on things should become much easier and faster, people will already see the right direction themselves.
## Inspiration
Here are some of the ideas/movements/ideologies and people whose ideas inspired less retarded society. It has to be stressed we never follow [people](hero_culture.md), only their ideas -- mentioning people here simply means we follow SOME of their ideas. Also keep in mind mentioning an idea here doesn't mean fully embracing it, we most likely only adopted some parts of it.
- **[anarcho pacifism](anpac.md)**: Rejecting force and hierarchy of one living being dominating and oppressing another.
- **Buddha, [Buddhism](buddhism.md)**: Attaining freedom through letting go, focusing on the spiritual rather than the material, living non violently.
- **[communism](communism.md), [anarcho communism](ancom.md), [socialism](socialism.md)**: Sharing, equality, rejection of property and money, focus on people at large.
- **[Diogenes](diogenes.md), [cynicism](cynicism.md)**: Rejecting conformity, wealth, power, fame, materialistic needs, embracing simple living in harmony with nature.
- **Gandhi, [non violence](nonviolence.md)**: Achieving things without the use of violence (and similar kinds of force), completely refusing to use certain unethical means for achieving goals, not abandoning one's beliefs even for the cost of one's life.
- **[Jesus](jesus.md), [Christianity](christianity.md)**: Teaching [love](love.md) towards everyone, even those who hurt us, practicing non violence, helping, sharing and compassion, opposing materialist values, valuing the spiritual, being ready to die for one's beliefs.
- **[minimalism](minimalism.md), [KISS](kiss.md), [suckless](suckless.md), [less is more](less_is_more.md), [worse is better](worse_is_better.md), [Unix philosophy](unix_philosophy.md), ...**: Way towards [freedom](freedom.md), both practical and spiritual, letting go of the unneeded, most essential design principle, beauty and elegance.
- **[primitivism](primitivism.md)**: Related to minimalism, letting go of unnecessary and focus on what matters the most, living close to nature.
- **[Richard Stallman](rms.md), [free software](free_software.md), [free culture](free_culture.md)**: Opposition of "[intellectual property](intellectual_property.md)", focus on ethics, freedom and technology/art serving the people.
- **[Sikhism](sikhism.md)**: Serving free food to all people as part of Langar, example of [selflessness](selflessness.md).
- **vegetarianism, [veganism](vegan.md)**: Choosing to not hurt other living beings, even those that aren't of the same species, even for the cost of making having less comfortable life.
- ...
## See Also ## See Also
- [LRS](lrs.md) - [LRS](lrs.md)

View file

@ -17,7 +17,7 @@ WORK IN PROGRESS
| [cloudflare](cloudfalre.md) | cuckflare, clownflare | | [cloudflare](cloudfalre.md) | cuckflare, clownflare |
| code of conduct ([COC](coc.md)) | code of coercion, code of censorship | | code of conduct ([COC](coc.md)) | code of coercion, code of censorship |
| consume | consoom (see also [coom](coom.md) | | consume | consoom (see also [coom](coom.md) |
| [copyright](copyright.md) | copywrong, copyrestriction | | [copyright](copyright.md) | copywrong, copyrestriction, copyrape |
| [CSS](css.md) | cascading style shit | | [CSS](css.md) | cascading style shit |
| [democracy](democracy.md) | democrazy | | [democracy](democracy.md) | democrazy |
| digital rights management ([DRM](drm.md)) | digital restrictions management | | digital rights management ([DRM](drm.md)) | digital restrictions management |

View file

@ -8,7 +8,7 @@ Welcome to [Less Retarded Wiki](lrs_wiki.md), an [encyclopedia](encyclopedia.md)
{ We have reached 2^9 articles, yay! Yeah, some are just empty, but it's nice. ~drummyfish } { We have reached 2^9 articles, yay! Yeah, some are just empty, but it's nice. ~drummyfish }
DISCLAIMER: All opinions expressed here are facts. I agree with myself 100%. DISCLAIMER: All opinions expressed here are facts. I agree with myself 100% (well, sometimes).
``` ```
.:FFFFF:. .:FFFFF:. .:FFFFFFFFFFF:. .:FFFFFFFFFFF:. .:FFFFF:. .:FFFFF:. .:FFFFFFFFFFF:. .:FFFFFFFFFFF:.

View file

@ -15,6 +15,8 @@ Specific practices used in marketing are:
These practices are not rare, they are not even a behavior of a minority, they are not illegal and people don't even see them as unusual or undesirable. People in the US are so brainwashed they even pay to see commercials (Super Bowl). Under capitalism these practices are the norm and are getting worse and worse ever year. These practices are not rare, they are not even a behavior of a minority, they are not illegal and people don't even see them as unusual or undesirable. People in the US are so brainwashed they even pay to see commercials (Super Bowl). Under capitalism these practices are the norm and are getting worse and worse ever year.
Good things don't need promotion (it's true even if you disagree). **The bigger the promotion, the bigger [shit](shit.md) it is.**
A naive idea still present among people is that ethical marketing is possible or that it's something that can be fixed by some law, a petition or something similar. In late stage capitalism this is not possible as an "ethical" marketing is a non effective marketing. Deciding to drop the most efficient weapons in the market warfare will only lead to the company losing customers to competition who embraces the unethical means, eventually going bankrupt and disappearing, leaving the throne to the bad guys. Laws will not help as laws are made to firstly favor the market, corporations pay full time lobbyists and law makers themselves are owners of corporations. Even if some small law against "unethical marketing" passes, the immense force and pressure of all the strongest corporations will work 24/7 on reverting the law and/or finding ways around it, legal or illegal, ethical or unethical. A naive idea still present among people is that ethical marketing is possible or that it's something that can be fixed by some law, a petition or something similar. In late stage capitalism this is not possible as an "ethical" marketing is a non effective marketing. Deciding to drop the most efficient weapons in the market warfare will only lead to the company losing customers to competition who embraces the unethical means, eventually going bankrupt and disappearing, leaving the throne to the bad guys. Laws will not help as laws are made to firstly favor the market, corporations pay full time lobbyists and law makers themselves are owners of corporations. Even if some small law against "unethical marketing" passes, the immense force and pressure of all the strongest corporations will work 24/7 on reverting the law and/or finding ways around it, legal or illegal, ethical or unethical.
**Marketing people are subhuman.** Of course, let us be reminded [we](lrs.md) love all living beings, even subhuman, but the marketing trash not only doesn't show any signs of conscience or [morals](morality.md), they hardly seems [conscious](consciousness.md) at all, they are just a robotic tool of [capitalism](capitalism.md), more akin monkeys -- however immoral shit they get into, they always just reply "[just doing my job](just_doing_my_job.md)" and "[it pays well](it_pays_well.md)" to anything. They make the worst kind of [propaganda](propaganda.md) which literally kills people, they would mercilessly torture children to death if it was on their contract. A capitalist is screeching HAHAHA IT NOT THE SAME bcuz CHILREN ARE MAGICAL n economy is pwogwesss, so this invalid. Indeed, it doesn't make any sense -- a capitalist will stay what it is, the lowest class of brainwashed [NPC](npc.md) incapable of thinking on its own. All in all, avoid anyone who has anything to do with marketing. **Marketing people are subhuman.** Of course, let us be reminded [we](lrs.md) love all living beings, even subhuman, but the marketing trash not only doesn't show any signs of conscience or [morals](morality.md), they hardly seems [conscious](consciousness.md) at all, they are just a robotic tool of [capitalism](capitalism.md), more akin monkeys -- however immoral shit they get into, they always just reply "[just doing my job](just_doing_my_job.md)" and "[it pays well](it_pays_well.md)" to anything. They make the worst kind of [propaganda](propaganda.md) which literally kills people, they would mercilessly torture children to death if it was on their contract. A capitalist is screeching HAHAHA IT NOT THE SAME bcuz CHILREN ARE MAGICAL n economy is pwogwesss, so this invalid. Indeed, it doesn't make any sense -- a capitalist will stay what it is, the lowest class of brainwashed [NPC](npc.md) incapable of thinking on its own. All in all, avoid anyone who has anything to do with marketing.

View file

@ -23,7 +23,7 @@ Up until recently in history every engineer would tell you that *the better mach
- [less is more](less_is_more.md)/[worse is better](worse_is_better.md) - [less is more](less_is_more.md)/[worse is better](worse_is_better.md)
- [appropriate technology](appropriate_tech.md) - [appropriate technology](appropriate_tech.md)
- [reactionary software](reactionary_software.md), though bordering with [pseudominimalism](pseudominimalism.md) - [reactionary software](reactionary_software.md), though bordering with [pseudominimalism](pseudominimalism.md)
- [plan9](plan9.md) and its followers such as [100rabbits](100rabbit.md) etc., though this often borders with [pseudominimalism](pseudominimalism.md) - [plan9](plan9.md) and its followers and/or groups hanging around it, e.g. [cat-v](cat_v.md) or [100rabbits](100rabbit.md) (though bordering with [pseudominimalism](pseudominimalism.md))
- [Collapse OS](collapseos.md)/[Dusk OS](duskos.md) - [Collapse OS](collapseos.md)/[Dusk OS](duskos.md)
- [permacomputing](permacomputing.md) ([SJW](sjw.md) warning) - [permacomputing](permacomputing.md) ([SJW](sjw.md) warning)
- ... - ...

View file

@ -56,9 +56,9 @@ Some notable open consoles (which fit the definition at least loosely) are liste
|Ringo/[MakerPhone](makerphone.md)|32b 160 MHz| 520 | 4000 | 160x128 | 2018 | A -, phone, SD | |Ringo/[MakerPhone](makerphone.md)|32b 160 MHz| 520 | 4000 | 160x128 | 2018 | A -, phone, SD |
|[Agon](agon.md) |8b 18 MHz | 512 | | 640x480 | | | |[Agon](agon.md) |8b 18 MHz | 512 | | 640x480 | | |
TODO: Retro Game Tiny, Adafruit PyGamer, ... see also https://github.com/ESPboy-edu/awesome-indie-handhelds TODO: Vircon32 (fantasy console implementable in HW, not sure about license), Retro Game Tiny, Adafruit PyGamer, ... see also https://github.com/ESPboy-edu/awesome-indie-handhelds
## See Also ## See Also
- [fantasy console](fantasy_console.md) - [fantasy console](fantasy_console.md)
- [DOS](dos.md) - [DOS](dos.md)

View file

@ -38,7 +38,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **[Single compilation unit](single_compilation_unit.md) (one big program without [linking](linking.md)) can help compiler optimize better** because it can see the whole code at once, not just its parts. It will also make your program compile faster. - **[Single compilation unit](single_compilation_unit.md) (one big program without [linking](linking.md)) can help compiler optimize better** because it can see the whole code at once, not just its parts. It will also make your program compile faster.
- Search literature for **algorithms with better [complexity class](complexity_class.md)** ([sorts](sorting.md) are a nice example). - Search literature for **algorithms with better [complexity class](complexity_class.md)** ([sorts](sorting.md) are a nice example).
- For the sake of simple computers such as [embedded](embedded.md) platforms **avoid [floating point](floating_point.md)** as that is often painfully slowly emulated in software. Use [fixed point](fixed_point.md), or at least offer it as a [fallback](fallback.md). This also applies to other hardware requirements such as [GPU](gpu.md) or sound cards: while such hardware accelerates your program on computers that have the hardware, making use of it may lead to your program being slower on computers that lack it. - For the sake of simple computers such as [embedded](embedded.md) platforms **avoid [floating point](floating_point.md)** as that is often painfully slowly emulated in software. Use [fixed point](fixed_point.md), or at least offer it as a [fallback](fallback.md). This also applies to other hardware requirements such as [GPU](gpu.md) or sound cards: while such hardware accelerates your program on computers that have the hardware, making use of it may lead to your program being slower on computers that lack it.
- **[Early branching](early_branching.md) can create a speed up** (instead of branching inside the loop create two versions of the loop and branch in front of them). This is a kind of space-time tradeoff. - **Factoring out invariants from loops and early branching can create a speed up**: it's sometimes possible to factor things out of loops (or even long non-looping code that just repeats some things), i.e. instead of branching inside the loop create two versions of the loop and branch in front of them. This is a kind of space-time tradeoff. Consider e.g. `while (a) if (b) func1(); else func2();` -- if *b* doesn't change inside the loop, you can rewrite this as `if (b) while (a) func1(); else while (a) func2();`. Or in `while (a) b += c * d;` if *c* and *d* don't change (are invariant), we can rewrite to `cd = c * d; while (a) b += cd;`. And so on.
- **Division can be replaced by multiplication by [reciprocal](reciprocal.md)**, i.e. *x / y = x * 1/y*. The point is that multiplication is usually faster than division. This may not help us when performing a single division by variable value (as we still have to divide 1 by *y*) but it does help when we need to divide many numbers by the same variable number OR when we know the divisor at compile time; we save time by precomputing the reciprocal before a loop or at compile time. Of course this can also easily be done with [fixed point](fixed_point.md) and integers! - **Division can be replaced by multiplication by [reciprocal](reciprocal.md)**, i.e. *x / y = x * 1/y*. The point is that multiplication is usually faster than division. This may not help us when performing a single division by variable value (as we still have to divide 1 by *y*) but it does help when we need to divide many numbers by the same variable number OR when we know the divisor at compile time; we save time by precomputing the reciprocal before a loop or at compile time. Of course this can also easily be done with [fixed point](fixed_point.md) and integers!
- **Consider the difference between logical and bitwise operators!** For example [AND](and.md) and [OR](or.md) boolean functions in C have two variants, one bitwise (`&` and `|`) and one logical (`&&` and `||`) -- they behave a bit differently but sometimes you may have a choice which one to use, then consider this: bitwise operators usually translate to only a single fast (and small) instruction while the logical ones usually translate to a branch (i.e. multiple instructions with potentially slow jumps), however logical operators may be faster because they are evaluated as [short circuit](short_circuit_eval.md) (e.g. if first operand of OR is true, second operand is not evaluated at all) while bitwise operators will evaluate all operands. - **Consider the difference between logical and bitwise operators!** For example [AND](and.md) and [OR](or.md) boolean functions in C have two variants, one bitwise (`&` and `|`) and one logical (`&&` and `||`) -- they behave a bit differently but sometimes you may have a choice which one to use, then consider this: bitwise operators usually translate to only a single fast (and small) instruction while the logical ones usually translate to a branch (i.e. multiple instructions with potentially slow jumps), however logical operators may be faster because they are evaluated as [short circuit](short_circuit_eval.md) (e.g. if first operand of OR is true, second operand is not evaluated at all) while bitwise operators will evaluate all operands.
- **Consider the pros and cons of using indices vs pointers**: When working with arrays you usually have the choice of using either pointers or indices, each option has advantages and disadvantages; working with pointers may be faster and produce smaller code (fewer instructions), but array indices are portable, may be smaller and safer. E.g. imagine you store your game sprites as a continuous array of images in RAM and your program internally precomputes a table that says where each image starts -- here you can either use pointers (which say directly the memory address of each image) or indices (which say the offset from the start of the big image array): using indices may be better here as the table may potentially be smaller (an index into relatively small array doesn't have to be able to keep any possible memory address) and the table may even be stored to a file and just loaded next time (whereas pointers can't because on next run the memory addresses may be different), however you'll need a few extra instructions to access any image (adding the index to the array pointer), which will however most definitely be negligible. - **Consider the pros and cons of using indices vs pointers**: When working with arrays you usually have the choice of using either pointers or indices, each option has advantages and disadvantages; working with pointers may be faster and produce smaller code (fewer instructions), but array indices are portable, may be smaller and safer. E.g. imagine you store your game sprites as a continuous array of images in RAM and your program internally precomputes a table that says where each image starts -- here you can either use pointers (which say directly the memory address of each image) or indices (which say the offset from the start of the big image array): using indices may be better here as the table may potentially be smaller (an index into relatively small array doesn't have to be able to keep any possible memory address) and the table may even be stored to a file and just loaded next time (whereas pointers can't because on next run the memory addresses may be different), however you'll need a few extra instructions to access any image (adding the index to the array pointer), which will however most definitely be negligible.
@ -47,7 +47,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **What's fast on one platform may be slow on another**. This depends on the instruction set as well as on compiler, operating system, available hardware, [driver](driver.md) implementation and other details. In the end you always need to test on the specific platform to be sure about how fast it will run. A good approach is to optimize for the weakest platform you want to support -- if it runs fasts on a weak platform, a "better" platform will most likely still run it fast. - **What's fast on one platform may be slow on another**. This depends on the instruction set as well as on compiler, operating system, available hardware, [driver](driver.md) implementation and other details. In the end you always need to test on the specific platform to be sure about how fast it will run. A good approach is to optimize for the weakest platform you want to support -- if it runs fasts on a weak platform, a "better" platform will most likely still run it fast.
- **Prefer preincrement over postincrement** (typically e.g. in a for loop), i.e. rather do `++i` than `i++` as the latter is a bit more complex and normally generates more instructions. - **Prefer preincrement over postincrement** (typically e.g. in a for loop), i.e. rather do `++i` than `i++` as the latter is a bit more complex and normally generates more instructions.
- **Mental calculation tricks**, e.g. multiplying by one less or more than a power of two is equal to multiplying by power of two and subtracting/adding once, for example *x * 7 = x * 8 - x*; the latter may be faster as a multiplication by power of two (bit shift) and addition/subtraction may be faster than single multiplication, especially on some primitive platform without hardware multiplication. However this needs to be tested on the specific platform. Smart compilers perform these optimizations automatically, but not every compiler is high level and smart. - **Mental calculation tricks**, e.g. multiplying by one less or more than a power of two is equal to multiplying by power of two and subtracting/adding once, for example *x * 7 = x * 8 - x*; the latter may be faster as a multiplication by power of two (bit shift) and addition/subtraction may be faster than single multiplication, especially on some primitive platform without hardware multiplication. However this needs to be tested on the specific platform. Smart compilers perform these optimizations automatically, but not every compiler is high level and smart.
- **Use switch instead of if branches** -- it should be common knowledge but some newcomers may not know that switch is fundamentally different from if branches: switch statement generates a jump table that can branch into one of many case labels in constant time, as opposed to a series of if statements which keeps checking conditions one by one, however switch only supports conditions of exact comparison. So prefer using switch when you have many conditions to check. Switch also allows hacks such as label fall through which may help some optimizations. - **With more than two branches use switch instead of ifs** (if possible) -- it should be common knowledge but some newcomers may not know that switch is fundamentally different from if branches: switch statement generates a jump table that can branch into one of many case labels in constant time, as opposed to a series of if statements which keeps checking conditions one by one, however switch only supports conditions of exact comparison. So prefer using switch when you have many conditions to check (but know that switch can't always be used, e.g. for string comparisons). Switch also allows hacks such as label fall through which may help some optimizations.
- **Else should be the less likely branch**, try to make if conditions so that the if branch is the one with higher probability of being executed -- this can help branch prediction. - **Else should be the less likely branch**, try to make if conditions so that the if branch is the one with higher probability of being executed -- this can help branch prediction.
- Similarly **order if-sequences and switch cases from most probable**: If you have a sequences of ifs such as `if (x) ... else if (y) ... else if (z) ...`, make it so that the most likely condition to hold gets checked first, then second most likely etc. Compiler most likely can't know the probabilities of the conditions so it can't automatically help with this. Do the same with the `switch` statement -- even though switch typically gets compiled to a table of jump addresses, in which case order of the cases doesn't matter, it may also get compiled in a way similar to the if sequence (e.g. as part of size optimization if the cases are sparse) and then it may matter again. - Similarly **order if-sequences and switch cases from most probable**: If you have a sequences of ifs such as `if (x) ... else if (y) ... else if (z) ...`, make it so that the most likely condition to hold gets checked first, then second most likely etc. Compiler most likely can't know the probabilities of the conditions so it can't automatically help with this. Do the same with the `switch` statement -- even though switch typically gets compiled to a table of jump addresses, in which case order of the cases doesn't matter, it may also get compiled in a way similar to the if sequence (e.g. as part of size optimization if the cases are sparse) and then it may matter again.
- **Variable aliasing**: If in a function you are often accessing a variable through some complex dereference of multiple pointers, it may help to rather load it to a local variable at the start of the function and then work with that variable, as dereferencing pointers costs something. { from *Game Programming Gurus* -drummyfish } - **Variable aliasing**: If in a function you are often accessing a variable through some complex dereference of multiple pointers, it may help to rather load it to a local variable at the start of the function and then work with that variable, as dereferencing pointers costs something. { from *Game Programming Gurus* -drummyfish }
@ -71,7 +71,26 @@ Another kind of optimization done during development is just automatically writi
## Automatic Optimization ## Automatic Optimization
TODO Automatic optimization is typically performed by the compiler; usually the programmer has the option to tell the compiler how much and in what way to optimize (no optimization, mild optimization, aggressive optimization, optimization for speed, size; check e.g. the man pages of [gcc](gcc.md) where you can see how to turn on even specific types of optimizations). Some compilers perform extremely complex reasoning to make the code more efficient, the whole area of optimization is a huge science -- here we'll only take a look at the very basic techniques. We see optimizations as transformations of the code that keep the semantics the same but minimize or maximize some measure (e.g. execution time, memory usage, power usage, network usage etc.). Automatic optimizations are usually performed on the intermediate representation (e.g. [bytecode](bytecode.md)) as that's the ideal way (we only write the optimizer once), however some may be specific to some concrete instruction set -- these are sometimes called *peephole* optimizations and have to be delayed until code generation.
The following are some common methods of automatic optimization (also note that virtually any method from the above mentioned manual optimizations can be applied if only the compiler can detect the possibility of applying it):
{ Tip: man pages of gcc or possibly other compilers detail specific optimizations they perform under the flags that turn them on, so see these man pages for a similar overview. ~drummyfish }
- **Replacing instructions with faster equivalents**: we replace an instruction (or a series of instructions) with another one that does the same thing but faster (or with fewer instructions etc.). Typical example is replacing multiplication by power of two with a bit shift (e.g. `x * 8` is the same as `x << 3`).
- **Inlining**: a function call may usually (not always though, consider e.g. [recursion](recursion.md)) be replaced by the function code itself inserted in the place of the call (so called inlining). This is faster but usually makes the code bigger so the compiler has to somehow judge and decide when it's worth to inline a function -- this may be affected e.g. by the function size (inlining a short function won't make the code that much bigger), programmer's hints (`inline` keyword, optimize for speed rather than size etc.) or guesstimating how often the function will be called. Function that is only called in one place can be safely inlined.
- **Loop unrolling**: dupliates the body of a loop, making the code bigger but increasing its speed (a condition check is saved). E.g. `for (int i = 0; i < 3; ++i) func();` may be replaced with `func(); func(); func();`. Unrolling may be full or just partial.
- **[Lazy](lazy_eval.md) evaluation/short circuit/test reordering**: the principles of lazy evaluation (evaluate function only when we actually need it) and short circuit evaluation (don't further evaluate functions when it's clear we won't need them) may be auto inserted into the code to make it more efficient. Test reordering may lead to first testing simpler things (e.g. equality comparison) and leaving complex tests (function calls etc.) for later.
- **Algebraic laws, expression evaluation**: expressions may be partially preevaluated and manipulated to stay mathematically equivalent while becoming easier to evaluate, for example `1 + 3 + 5 * 3 * x / 6` may be transformed to just `4 + 5 * x / 2`.
- **Removing instructions that cancel out**: for example in [Brainfuck](brainfuck.md) the series of instructions `+++--` may be shortened to just `+`.
- **Removing instructions that do nothing**: generated code may contain instructions that just do nothing, e.g. NOPs that were used as placeholders that never got replaced; these can be just removed.
- **Register allocation**: most frequently used variables should be kept in CPU registers for fastest access.
- **Removing branches**: branches are often expensive due to not being CPU pipeline friendly, they can sometimes be replaced by a branch-free code, e.g. `if (a == b) c = 1; else c = 0;` can be replaced with `c = a == b;`.
- **Memory alignment, reordering etc.**: data stored in memory may be reorganized for better efficiency, e.g. an often accessed array of bytes may actually be made into array of ints so that each item resides exactly on one address (which takes fewer instructions to access and is therefore faster). Data may also be reordered to be more [cache](cache.md) friendly.
- **Generating [lookup tables](lut.md)**: if the optimizer judges some function to be critical in terms of speed, it may auto generate a lookup table for it, i.e. precompute its values and so sacrifice some memory for making it run extremely fast.
- **Dead code removal**: parts of code that aren't used can be just removed, making the generated program smaller -- this includes e.g. functions that are present in a [library](library.md) which however aren't used by the specific program or blocks of code that become unreachable e.g. due to some `#define` that makes an if condition always false etc.
- **[Compression](compression.md)**: compression methods may be applied to make data smaller and optimize for size (for the price of increased CPU usage).
- ...
## See Also ## See Also

3
permacomputing.md Normal file
View file

@ -0,0 +1,3 @@
# Permacomputing
Permacomputing is a new term invented by [Viznut](viznut.md), it's inspired by the term *[permaculture](permaculture.md)* and means something like "sustainable, ecological minimalist computing"; see [permacomputing wiki](permacomputing_wiki.md).

View file

@ -28,4 +28,16 @@ Pokito, unlike most other open consoles, is NOT based on [Arduino](arduino.md),
**Downsides** of Pokitto are that the community is an [open source](open_source.md) community rather than [free software](free_software.md) one, purists like us will find they lean towards [bloated](bloat.md) solutions even though the technical limitation of the console largely prevent their implementation. The web forums runs on [discourse](discourse.md) and requires [JavaScript](js.md) for interactivity. [Discord](discord.md) is also actively used for communication, even though some community members bridged it to free alternatives. The official library is relatively bloated and even contains some small pieces of unlicensed code from the [MCU](mcu.md) manufacturer -- they are very simple assembly snippets that may be easily replacaeble, but we should be cautious even about this. Anyway, a reasonably dedicated programmer might create a suckless Pokitto library without greater problems. **Downsides** of Pokitto are that the community is an [open source](open_source.md) community rather than [free software](free_software.md) one, purists like us will find they lean towards [bloated](bloat.md) solutions even though the technical limitation of the console largely prevent their implementation. The web forums runs on [discourse](discourse.md) and requires [JavaScript](js.md) for interactivity. [Discord](discord.md) is also actively used for communication, even though some community members bridged it to free alternatives. The official library is relatively bloated and even contains some small pieces of unlicensed code from the [MCU](mcu.md) manufacturer -- they are very simple assembly snippets that may be easily replacaeble, but we should be cautious even about this. Anyway, a reasonably dedicated programmer might create a suckless Pokitto library without greater problems.
Some quite nice [hacks](hacking.md) were achieved with Pokitto, e.g. using it as a display for a PC or even running [GameBoy](gameboy.md) games on it -- this was done thank to a small [FOSS](foss.md) GameBoy emulator and a tool that packs this emulator along with selected GameBoy ROM into a Pokitto executable -- this of course comes with some limitations, e.g. on sound or game size. Yes, Pokitto quite comfortably runs [Anarch](anarch.md). Some quite nice [hacks](hacking.md) were achieved with Pokitto, e.g. using it as a display for a PC or even running [GameBoy](gameboy.md) games on it -- this was done thank to a small [FOSS](foss.md) GameBoy emulator and a tool that packs this emulator along with selected GameBoy ROM into a Pokitto executable -- this of course comes with some limitations, e.g. on sound or game size. Yes, Pokitto quite comfortably runs [Anarch](anarch.md).
## How To, Tips'N'Tricks
TODO
**Uploading** programs to Pokitto under [GNU](gnu.md)/[Linux](linux.md) can be done e.g. with [dd](dd.md) (or mcopy etc.) like this:
```
sudo mount /dev/sdb ~/mnt
sudo dd bs=256 conv=nocreat,notrunc,sync,fsync if=~/git/Anarch/bin/Anarch_pokitto_nonoverclock_1-01.bin of=~/mnt/firmware.bin
sudo umount ~/mnt
```

View file

@ -19,7 +19,7 @@ At first you have to learn two basic rules that have to be constantly on your mi
1. **You cannot be a good programmer if you're not good at [math](math.md)** -- real programming is pure math. 1. **You cannot be a good programmer if you're not good at [math](math.md)** -- real programming is pure math.
2. **[minimalism](minimalism.md) is the most important concept in programming.** If you don't like, support or understand minimalism, don't even think of becoming a programmer. 2. **[minimalism](minimalism.md) is the most important concept in programming.** If you don't like, support or understand minimalism, don't even think of becoming a programmer.
OK, now the key thing to becoming a programmer is learning a [programming language](programming_language.md) very well (and learning many of them), however this is not enough (it's only enough for becoming a coding monkey), you additionally have to have a wider knowledge such as general knowledge of computers ([electronics](electronics.md), [hardware](hardware.md), theory or computation, [networks](networking.md), ...), tech [history](history.md) and culture ([free software](free_software.md), [hacker cutlure](hacking.md), [free culture](free_culture.md), ...), [math](math.md) and [science](science.md) in general, possibly even society, philosophy etc. Programming is not an isolated topic (only coding is), a programmer has to see the big picture and have a number of other big brain interests such as [chess](chess.md), voting systems, linguistics, physics, music etc. Remember, becoming a good programmer takes a whole life, sometimes even longer. OK, now the key thing to becoming a programmer is learning a [programming language](programming_language.md) very well (and learning many of them), however this is not enough (it's only enough for becoming a [coding](coding.md) monkey), you additionally have to have a wider knowledge such as general knowledge of [computers](computer.md) ([electronics](electronics.md), [hardware](hardware.md), theory or [computation](computation.md), [networks](networking.md), ...), tech [history](history.md) and culture ([free software](free_software.md), [hacker cutlure](hacking.md), [free culture](free_culture.md), ...), [math](math.md) and [science](science.md) in general, possibly even society, philosophy etc. Programming is not an isolated topic (only coding is), a programmer has to see the big picture and have a number of other big brain interests such as [chess](chess.md), voting systems, linguistics, physics, [music](music.md) etc. Remember, becoming a good programmer takes a whole life, sometimes even longer.
**Can you become a good programmer when you're old?** Well, as with everything to become a SERIOUSLY good programmer you should have probably started before the age of 20, the majority of the legend programmers started before 10, it's just like with sports or becoming an excellent musician. But with enough enthusiasm and endurance you can become a pretty good programmer at any age, just like you can learn to play an instrument or run marathon basically at any age, it will just take longer and a lot of energy. You don't even have to aim to become very good, becoming just average is enough to write simple gaymes and have a bit of fun in life :) Just don't try to learn programming because it seems cool, because you want to look like movie haxor, gain followers on youtube or because you need a job -- if you're not having genuine fun just thinking before sleep about how to swap two variables without using a temporary variable, programming is probably not for you. **Can you become a good programmer if you're black or [woman](woman.md)?** No. :D Ok, maybe you can, but all the above applies, don't do it for politics or money or followers -- if you become a seriously based programmer (from [LRS](lrs.md) point of view) of unlikely minority, we'll be more than happy to put an apology here, in ALL CAPS and bold letters :) Hopefully this will inspire someone... **Can you become a good programmer when you're old?** Well, as with everything to become a SERIOUSLY good programmer you should have probably started before the age of 20, the majority of the legend programmers started before 10, it's just like with sports or becoming an excellent musician. But with enough enthusiasm and endurance you can become a pretty good programmer at any age, just like you can learn to play an instrument or run marathon basically at any age, it will just take longer and a lot of energy. You don't even have to aim to become very good, becoming just average is enough to write simple gaymes and have a bit of fun in life :) Just don't try to learn programming because it seems cool, because you want to look like movie haxor, gain followers on youtube or because you need a job -- if you're not having genuine fun just thinking before sleep about how to swap two variables without using a temporary variable, programming is probably not for you. **Can you become a good programmer if you're black or [woman](woman.md)?** No. :D Ok, maybe you can, but all the above applies, don't do it for politics or money or followers -- if you become a seriously based programmer (from [LRS](lrs.md) point of view) of unlikely minority, we'll be more than happy to put an apology here, in ALL CAPS and bold letters :) Hopefully this will inspire someone...
@ -29,4 +29,6 @@ OK, now the key thing to becoming a programmer is learning a [programming langua
**[Games](game.md) are an ideal start project** because they're [fun](fun.md) (having fun makes learning much faster and enjoyable), there are many noob tutorials all over the Internet etc. However keep in mind to **start EXTREMELY simple.** -- this can't be stressed enough, most people are very impatient and eager and start making an RPG game or networking library without really knowing a programming language -- this is a GUARANTEED spectacular failure. At the beginning think in terms of "snake" and "minesweeper". Your very first project shouldn't even use any [GUI](gui.md), it should be purely [command-line](cli.md) text program, so a text-only tiny interactive story in [Python](python.md) is possibly the absolutely best choice as a first project. Once you're more comfortable you may consider to start using graphics, e.g. Python + [Pygame](pygame.md), but still [KEEP IT SIMPLE](kiss.md), make a flappy bird clone or something. As you progress, consider perhaps buying a simple toy computer such as an [open console](open_console.md) -- these toys are closer to old computers that had no operating systems etc., they e.g. let you interact directly with hardware and teach you a LOT about good programming by teaching you how computers actually work under the hood. One day you will have to make the big step and **learn [C](c.md)**, the best and most important language as of yet, but be sure to only start learning it when you're at least intermediate in your start language (see our [C tutorial](c_tutorial.md)). To learn C we recommend our [SAF](saf.md) library which will save you all headaches of complex APIs and your games will be nice and compatible with you small toy computers. **[Games](game.md) are an ideal start project** because they're [fun](fun.md) (having fun makes learning much faster and enjoyable), there are many noob tutorials all over the Internet etc. However keep in mind to **start EXTREMELY simple.** -- this can't be stressed enough, most people are very impatient and eager and start making an RPG game or networking library without really knowing a programming language -- this is a GUARANTEED spectacular failure. At the beginning think in terms of "snake" and "minesweeper". Your very first project shouldn't even use any [GUI](gui.md), it should be purely [command-line](cli.md) text program, so a text-only tiny interactive story in [Python](python.md) is possibly the absolutely best choice as a first project. Once you're more comfortable you may consider to start using graphics, e.g. Python + [Pygame](pygame.md), but still [KEEP IT SIMPLE](kiss.md), make a flappy bird clone or something. As you progress, consider perhaps buying a simple toy computer such as an [open console](open_console.md) -- these toys are closer to old computers that had no operating systems etc., they e.g. let you interact directly with hardware and teach you a LOT about good programming by teaching you how computers actually work under the hood. One day you will have to make the big step and **learn [C](c.md)**, the best and most important language as of yet, but be sure to only start learning it when you're at least intermediate in your start language (see our [C tutorial](c_tutorial.md)). To learn C we recommend our [SAF](saf.md) library which will save you all headaches of complex APIs and your games will be nice and compatible with you small toy computers.
As with everything, you learn by doing -- reading is extremely important and necessary, but to actually learn anything you have to spend thousands of hours practicing the art yourself. So **program, program and program**, live by programming, look for ways of using programming in what you're already doing, try to automatize anything you do, think about programming before sleep etc. If you can, **contribute to some project**, best if you can help your favorite [FOSS](foss.md) program -- try this at least once as being in the company of the experienced just teaches you like nothing else, a month spent contributing to a project may be worth a year of just reading books.
TODO TODO

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,10 @@
# Suckless # Suckless
Suckless, software that [sucks](suck.md) less, is a type of [free](free_software.md) [software](software.md), as well as an organization (http://suckless.org/), that tries to adhere to a high technological [minimalism](minimalism.md), [freedom](freedom.md) and [hackability](hacking.md), and opposes so called [bloat](bloat.md) and unnecessary complexity which has been creeping into most "[modern](modern.md)" software and by which technology has started to become less useful and more burdening. It is related to [Unix philosophy](unix_philosophy.md) and [KISS](kiss.md) but brings some new ideas onto the table. New movements now came to existence from suckless, e.g. [Bitreich](bitreich.md) and our own [less retarded software](lrs.md). Suckless seems quite related to [cat-v](cat_v.md). Suckless, software that [sucks](suck.md) less, is a type of [free](free_software.md) [software](software.md), programming philosophy as well as an organization (http://suckless.org/), that tries to adhere to a high technological [minimalism](minimalism.md), [freedom](freedom.md) and [hackability](hacking.md), and opposes so called [bloat](bloat.md) and unnecessary complexity which has been creeping into most "[modern](modern.md)" software and by which technology has started to become less useful and more burdening. It is related to [Unix philosophy](unix_philosophy.md) and [KISS](kiss.md) but brings some new ideas onto the table. It became somewhat known and highly influenced some newly formed groups, e.g. [Bitreich](bitreich.md) and our own [less retarded software](lrs.md). Suckless seems to share many followers with [cat-v.org](cat_v.md).
The community is relatively a small niche but has also seen a growth in popularity sometime in 2010s, thanks to tech youtubers such as [Luke Smith](luke_smith.md), [Distro Tube](distro_tube.md) and [Mental Outlaw](mental_outlaw.md). It has also gained traction on [4chan](4chan.md)'s technology board. While consisting a lot of expert programmers and [hackers](hacker.md) mostly interested in systems like [GNU](gnu.md)/[Linux](linux.md), [BSDs](bsd.md) and [Plan 9](plan9.md), a lot of less skilled "[Linux](linux.md)" users and even complete non-programmers have started to use suckless to various degrees -- [dwm](dwm.md) has for example seen a great success among "Unix porn" lovers and chronic [ricers](ricing.md). While some members are hardcore minimalists and apply their principles to everything, some just cherry pick programs they find nice and integrate them in their otherwise bloated systems. The community used to be relatively a small underground niche, however after a rise in popularity sometime in 2010s, thanks to tech youtubers such as [Luke Smith](luke_smith.md), [Distro Tube](distro_tube.md) and [Mental Outlaw](mental_outlaw.md), the awareness about the group spread a lot wider, even mainstream programmers now usually know what *suckless* stands for. It has also gained traction on [4chan](4chan.md)'s technology board which again boosted suckless popularity but also inevitably brought some retardism in. While the group core consisting a lot of expert programmers and [hackers](hacker.md) mostly interested in systems like [GNU](gnu.md)/[Linux](linux.md), [BSDs](bsd.md) and [Plan 9](plan9.md), a lot of less skilled "[Linux](linux.md)" users and even complete non-programmers now hang around suckless to various degrees -- especially the [dwm](dwm.md) window manager has seen a great success among "Unix porn" lovers and chronic [ricers](ricing.md). While most of the true suckless followers are hardcore minimalists and apply their principles to everything, many of the noobs around suckless just cherry pick programs they find nice to look at and integrate them in their otherwise bloated systems.
Suckless is pretty cool, it has inspired [LRS](lrs.md), but watch out, as with most of the few promising things nowadays it is half cool and half shitty -- for example most suckless followers seem to be [rightists](left_vs_right.md) and [capitalists](capitalism.md) who are motivated by [harmful](harmful.md) goals such as their own increased [productivity](productivity_cult.md), not by [altruism](altruism.md). LRS fixes this, we only take the good ideas of suckless. Also it seems like by now that part of the suckless community degenerated a bit by its increase in popularity into a bit of what it opposed -- a kind of consumerist fashion followers who aren't interested so much in good design of technology but rather constantly ricing their dwm in pursuit of cool looking [pseudominimalist](pseudominimalism.md) system in ways not dissimilar to those of iToddlers. Suckless is pretty cool, it has inspired [LRS](lrs.md), but watch out, as with most of the few promising things nowadays it is half cool and half shitty -- for example most suckless followers seem to be [rightists](left_vs_right.md) and [capitalists](capitalism.md) who are motivated by [harmful](harmful.md) goals such as their own increased [productivity](productivity_cult.md), not by [altruism](altruism.md). Many suckless people are quite pragmatic -- though they believe in hardcore minimalism, they will oftentimes, for practical reasons, rather choose e.g. a well established programming language ([C](c.md)) before the more minimal one (e.g. [Forth](forth.md)). LRS takes the good and tries to fix the issues of suckless, we only take the good ideas of suckless. Also it seems like by now that part of the suckless community degenerated a bit by its increase in popularity into a bit of what it opposed -- a kind of consumerist fashion followers who aren't interested so much in good design of technology but rather constantly ricing their dwm in pursuit of cool looking [pseudominimalist](pseudominimalism.md) system in ways not dissimilar to those of iToddlers.
{ From what it seems to me, the "official" suckless community is largely quiet and closed, leading conversations mostly on mailing lists and focusing almost exclusively on the development of their software without politics, activism and off topics, probably because they consider it bullshit that would only be distracting. There is also suckless subreddit which is similarly mostly focused on the software alone. They let their work speak. Some accuse the community of being Nazis, however I believe this is firstly irrelevant and secondly mostly false accusations of haters, even if we find a few Nazis among them, just as in any community. Most pro-suckless people I've met were actually true socialists (while Nazis are not socialist despite their name). Unlike [tranny software](tranny_software.md), suckless software itself doesn't promote any politics, it is a set of purely functional tools, so the question of the developers' private opinions is unimportant here, we have to separate ideas and people. Suckless ideas are good regardless of whose brains they came from. ~drummyfish } { From what it seems to me, the "official" suckless community is largely quiet and closed, leading conversations mostly on mailing lists and focusing almost exclusively on the development of their software without politics, activism and off topics, probably because they consider it bullshit that would only be distracting. There is also suckless subreddit which is similarly mostly focused on the software alone. They let their work speak. Some accuse the community of being Nazis, however I believe this is firstly irrelevant and secondly mostly false accusations of haters, even if we find a few Nazis among them, just as in any community. Most pro-suckless people I've met were actually true socialists (while Nazis are not socialist despite their name). Unlike [tranny software](tranny_software.md), suckless software itself doesn't promote any politics, it is a set of purely functional tools, so the question of the developers' private opinions is unimportant here, we have to separate ideas and people. Suckless ideas are good regardless of whose brains they came from. ~drummyfish }

View file

@ -30,4 +30,5 @@ There still seems to be some people developing the OS and applications for it, e
## See Also ## See Also
- [Timecube](timecube.md) - [Timecube](timecube.md)
- [Sonichu](sonichu.md)

File diff suppressed because one or more lines are too long

View file

@ -3,8 +3,8 @@
This is an autogenerated article holding stats about this wiki. This is an autogenerated article holding stats about this wiki.
- number of articles: 552 - number of articles: 552
- number of commits: 683 - number of commits: 684
- total size of all texts in bytes: 2935068 - total size of all texts in bytes: 2936188
longest articles: longest articles:
@ -24,6 +24,17 @@ longest articles:
latest changes: latest changes:
``` ```
Date: Thu Feb 8 12:07:53 2024 +0100
bootstrap.md
fantasy_console.md
faq.md
living.md
lrs_dictionary.md
main.md
operating_system.md
random_page.md
wiki_pages.md
wiki_stats.md
Date: Thu Feb 8 08:32:34 2024 +0100 Date: Thu Feb 8 08:32:34 2024 +0100
arduboy.md arduboy.md
holy_war.md holy_war.md
@ -45,14 +56,6 @@ unix_philosophy.md
vim.md vim.md
wiki_pages.md wiki_pages.md
wiki_stats.md wiki_stats.md
Date: Tue Feb 6 07:30:19 2024 +0100
corporation.md
debugging.md
lrs_dictionary.md
optimization.md
programming_language.md
wiki_pages.md
wiki_stats.md
``` ```
most wanted pages: most wanted pages: