This commit is contained in:
Miloslav Ciz 2022-04-05 20:44:43 +02:00
parent b028290107
commit ca8db11490
11 changed files with 67 additions and 16 deletions

21
c.md
View file

@ -2,15 +2,10 @@
{ We have a [C tutorial](c_tutorial.md)! ~drummyfish }
C is a low-level, statically typed imperative compiled language, the go-to language of most [less retarded software](lrs.md). It is the absolutely preferred language of the [suckless](suckless.md) community as well as of most true experts, for example the [Linux](linux.md) and [OpenBSD](openbsd.md) developers, because of its good minimal design, level of control, uncontested performance and a greatly established and tested status.
C is a [low level](low_level.md), statically typed imperative compiled language, the go-to language of most [less retarded software](lrs.md). It is the absolutely preferred language of the [suckless](suckless.md) community as well as of most true experts, for example the [Linux](linux.md) and [OpenBSD](openbsd.md) developers, because of its good minimal design, level of control, uncontested performance and a greatly established and tested status.
C is usually not considered an easy language to learn because of its low level nature: it requires good understanding of how a computer actually works and doesn't prevent the programmer from shooting himself in the foot. Programmer is given full control (and therefore responsibility). There are things considered "tricky" which one must be aware of, such as undefined behavior of certain operators and raw pointers. This is what can discourage a lot of modern "coding monkeys" from choosing C, but it's also what inevitably allows such great performance -- undefined behavior allows the compiler to choose the most efficient implementation.
For more about C see:
- [C pitfalls](c_pitfalls.md)
- TODO
## History and Context
## Standards
@ -30,9 +25,9 @@ The standards of C99 and older are considered pretty [future-proof](future_proof
## Compilers
- gcc
- clang
- tcc
- [gcc](gcc.md)
- [clang](clang.md)
- [tcc](tcc.md)
- scc
## Standard Library
@ -144,4 +139,10 @@ RETURN_TYPE myFunction (TYPE1 param1, TYPE2 param2, ...)
// do something here
}
```
```
## See Also
- [C pitfalls](c_pitfalls.md)
- [C tutorial](c_tutorial.md)
- [IOCCC](ioccc.md)

View file

@ -4,6 +4,8 @@
Capitalism is the worst economic system we've yet seen in the history.^[source](logic.md) Literally based on pure greed, abandoning all morals and putting profit above everything else including preservation of life itself, capitalism fuels the worst in people and forces them to compete and suffer for basic needs. Capitalism is anti-progress, anti-technology, anti-freedom, supports immense waste of resources, wars, abuse of people, destruction of environment, decline of morals, invention of [bullshit](bullshit.md), [torture](marketing.md) of people and much more.
Capitalism produces the [worst imaginable technology](capitalist_software.md). It also inevitably leads to societal [collapse](collapse.md); in capitalism people own nothing and become wholly dependent on corporations which exploit this fact to abuse them. No one own anything, products become services (your car won't drive without internet connection and permission from its manufacturer), all independency and decentralization is lost in favor of a highly fragile and interdependent economy and infrastructure of services. Then only a slight break in the chain is enough to bring the whole civilization down.
Capitalism produces the [worst imaginable technology](capitalist_software.md). It also inevitably leads to societal [collapse](collapse.md); in capitalism people own nothing and become wholly dependent on corporations which exploit this fact to abuse them. This is achieved by [slowly boiling the frogs](slowly_boiling_the_frog.md). No one owns anything, products become services (your car won't drive without Internet connection and permission from its manufacturer), all independency and decentralization is lost in favor of a highly fragile and interdependent economy and infrastructure of services. Then only a slight break in the chain is enough to bring the whole civilization down.
The principal problem of capitalism lies in its **primary and only goal of self-benefit**, i.e. maximization of capital, combined with the fact that the environment of free market is a system with **Darwinian evolution** which through natural selection extremely effectively and quickly optimizes for the given goal, i.e. profit, on the detriment of all other values such as well being of people, sustainability or morality. In other words capitalism has never promised a good society, it literally only states that everyone should try to benefit oneself as much as possible, i.e. defines the [fitness function](fitness_function.md) purely as the ability to seize as many resources as possible, and then selects and rewards those who best implement this function, i.e. those we would call sociopaths or "dicks", and to those is given the power over society. In other words we simply get what we set to achieve: find entities that are best at making profit for any cost. The inevitable decline of society can not possibly be prevented by laws, any effort of trying to stop evolution by inventing artificial rules on the go is a battle against nature itself and is extremely naive, the immense power of the evolutionary system that's constantly in work to find ways to bypass or cancel laws in the way of profit and abuse of others will prevails just as life will always find its way to survive and thrive even in the worst conditions on Earth. The problem is not that "people are dicks", it is that we choose to put in place a system that rewards the dicks, a system that fuels the worst in people and smothers the best in them.
Capitalism is not really a socioeconomic system, it is the lack of one -- this is what people means when they say that capitalism [simply works](just_werks.md) or that it's *natural* -- it's the least effort option, one that simply lets people behave like animals. It is natural in the same way wars, murders, bullying and deadly diseases are. It is the most primitive system imaginable, it is uncontrolled, leads to suffering and self-destruction.

View file

@ -1,6 +1,6 @@
# International Obfuscated C Code Contest
The International Obfuscated C Code Contest (IOCCC for short) is an annual online contest in making the most creatively [obfuscated](obfuscation.md) programs in [C](c.md). It's kind of a "just for [fun](fun.md)" thing but similarly to [esoteric languages](esolang.md) there's an element of art and clever hacking that carries a great value. While the [productivity freaks](productivity_cult.md) will argue this is just a waste of time, the true programmer appreciates the depth of knowledge and creative thinking needed to develop a beautifully obfuscated programs. The contest runs since 1984 and was started by Landon Curt Noll and Larry Bassel.
The International Obfuscated C Code Contest (IOCCC for short) is an annual online contest in making the most creatively [obfuscated](obfuscation.md) programs in [C](c.md). It's kind of a "just for [fun](fun.md)" thing but similarly to [esoteric languages](esolang.md) there's an element of art and clever hacking that carries a great value. While the [productivity freaks](productivity_cult.md) will argue this is just a waste of time, the true programmer appreciates the depth of knowledge and creative thinking needed to develop a beautifully obfuscated program. The contest runs since 1984 and was started by Landon Curt Noll and Larry Bassel.
Unfortunately some [shit](shit.md) is flying around IOCCC too, for example confusing licensing -- having a [CC-BY-SA](cc_by_sa.md) license in website footer and explicitly prohibiting commercial use in the text, WTF? Also the team started to use [Microshit](microsoft.md)'s [GitHub](github.md). They also allow latest [capitalist](capitalist_software.md) C standards, but hey, this is a contest focused on ugly C, so perhaps it makes sense.

3
left.md Normal file
View file

@ -0,0 +1,3 @@
# Left
See [left vs right](left_right.md).

28
left_right.md Normal file
View file

@ -0,0 +1,28 @@
# Left Vs Right
Left and right are two basic opposing political sides that roughly come down to the pro-equality (left) and pro-hierarchy (right). There is a lot of confusion and vagueness about these terms, so let us now define these terms as used on this wiki:
- The (true) **left is pro social equality**, i.e. against social hierarchies. This includes equality of everyone, period. Note that social equality does NOT imply people being made (or being made to appear) equal in other ways, e.g. physically -- true left accepts difference between people and [races](race.md) and doesn't hide them. Even if the perfectly ideally leftist society can't be completely achieved, true left tries to get **as close to it as possible**. The values of true left are for example sharing, [love](love.md), [selflessness](selflessness.md), [altruism](altruism.md), forgiveness and nonviolence. Groups and movements that are at least highly truly leftist include [anarcho pacifism](anpac.md), [free software](free_software.md), [free culture](free_culture.md) and of course [LRS](lrs.md).
- The **right is pro social hierarchy**, i.e. against social equality. This means some people standing above others, be it by strength, power, wealth, social status, privileges etc. The rightist values are mostly those associated with [evil](evil.md), i.e. violence, oppression, conflict, war, revenge, survival of the fittest etc. Among rightism can be included [fascism](fascism.md), [capitalism](capitalism.md), US republican party, states, the military etc.
- The **pseudoleft** is pretending to be left while in fact being right due to e.g. using non-leftist means (such as violence) or even having non-leftist goals (e.g. benefit of specific minority as opposed to benefit of everyone). Among pseudoleftist movements are [feminism](feminism.md), [LGBT](lgbt.md), [Antifa](antifa.md) or [Marxism](marxism.md).
There exists a "theory" called a horse shoe. It says that the extremes of the left-right spectrum tend to be alike (violence, hating, radical), just as the two ends of a horse shoe. This is only an illusion caused by ignoring the existence of pseudoleft. The following diagram shows the true situation:
```
TRUE LEFT (peace, selflessness, forgiveness, ...)
<-------------------.
/ \
| | <== illusion of horse shoe
| |
\ /
PSEUDOLEFT RIGHT
(violence, conflict, aggressivity, ...)
```
We see pseudoleft is something that began as going away from the right but slowly turned around back to its values, just from a slightly different direction. This is because rightism is very easy, it offers tempting short-term solutions such as violence, and so it exhorts a kind of magnetic force on every human -- most cannot resist and only very few get to the true left despite this force.
What's called *left* in the [modern](modern.md) western culture usually means *pseudoleft*. The existence of pseudoleftism is often overlooked or unknown. It is a camp that falsely calls itself [leftist](left.md) while being in fact [rightist](right.md) in disguise. It used to be found mainly in the [US](us.md), however globalization spreads this [cancer](cancer.md) all over the world. Pseudoleft justifies its actions with a goal that may seem truly leftist, such as "equality", but uses means completely unacceptable by true left (which are in fact incompatible with equality), such as [violence](violence.md), bullying, lynching, [cancelling](cancel_culture.md), [censorship](censorship.md) or brainwashing. Pseudoleft is aggressive. It believes that **ends justify the means** and that **it's fine to bully a bully** ("eye for an eye"). A pseudoleftist movement naturally evolves towards shifting its goals from a leftist one such as equality towards a [fascist](fascism.md) one such as a (blind) *fight for some group's rights* (even if that group may already have achieved equality and more).
The difference between left and pseudoleft can be shown in many ways; one of them may be that pseudoleft always wants to **[fight](fight_culture.md)** something, usually the right (as they're essentially the same, i.e. natural competitiors). True left wants to end all fights. Pseudoleft invents [bullshit](bullshit.md) artificial issues such as [political correctness](political_correctness.md) that sparks conflict, as it lives by conflict. Left tries to find peace by solving problems. Pseudoleft sees it as acceptable to do bad things to people who commited something it deems bad. True left knows that violence creates violence, it "turns the other cheek", it cures hate with love.

View file

@ -29,6 +29,7 @@ If you don't know where to start, here are some suggestions. If you're new, the
- [less retarded software](lrs.md)
- [capitalist software](capitalist_software.md)
- [C tutorial](c_tutorial.md)
- [pseudoleft](pseudoleft.md)
And if you just want something more obscure and [fun](fun.md), check out these:

View file

@ -12,7 +12,7 @@ And before you say "it was faster and longer on battery etc. because it was simp
- **Old computers were faster** and astronomically more efficient. Computers with a few MhZ single-core CPU and under a megabyte of RAM booted faster to [DOS](dos.md) than modern computers boot to Windows 10, despite [Moore's law](moores_law.md) (this shittiness is known as [Wirth's law](wirths_law.md)). Old tech also **reacted faster to input** (had shorter lag) thanks to shorter input and output processing [pipelines](pipeline.md). { I've heard this confirmed from [John Carmack](carmack.md) in a talk on his development of [VR](vr.md). ~drummyfish }
- Old devices such as cell phones **lasted much, much longer on battery**. The old phones such as Nokia 3310 would **last long over a week** on stand-by.
- **Old software was shipped finished, complete and with minimum [bugs](bug.md)**. Nowadays newly released "[apps](app.md)" and [games](game.md) are normally released unfinished, even in pre-alpha states and even "finished" ones have [bugs](bug.md) often rendering the software unsuable (see Cyberpunk 2077, GTA: Definiteve Edition etc.), user is supposed to wait years for fixes (without any guarantees), pay for content or even subscriptions. Old software was difficult or even impossible to patch (e.g. on [Gameboy](gameboy.md)) so it had to work.
- **Old tech had minimum malicious features**. There wasn't [spyware in CPUs](inte_me.md), **[DRM](drm.md) was either absent or primitive**, there weren't ads in file explorers, there weren't [microtransactions](microtransaction.md) in games, there weren't [autoupdates](autoupdate.md), there weren't psychologically abusive [social networks](social_network.md), technology was **designed to last**, not to be [consoomed](consumerism.md), there was much less [censhorship](censorship.md).
- **Old tech had minimum malicious features**. There wasn't [spyware in CPUs](intel_me.md), **[DRM](drm.md) was either absent or primitive**, there weren't ads in file explorers, there weren't [microtransactions](microtransaction.md) in games, there weren't [autoupdates](autoupdate.md), there weren't psychologically abusive [social networks](social_network.md), technology was **designed to last**, not to be [consoomed](consumerism.md), there was much less [censhorship](censorship.md).
- **Old tech was much easier to modify and customize**, thanks to not being so overcomplicated and not containing so many anti-repair "features". Old software wasn't in the [cloud](cloud.md) which makes it impossible to be modified.
- **Old tech was much more independent**, did not require Internet connectivity, subscription etc.
- There was **minimum [bullshit](bullshit.md)**. True usefulness was more important than killer features to help marketing.

View file

@ -2,23 +2,26 @@
Optimization means making a program more efficient in terms of some metric such as speed or memory usage (but also others such as power consumption, network usage etc.) while preserving its functionality.
Unlike [refactoring](refactoring.md), oprimization changes the behavior of the program to a more optimal one (but again, it doesn't change its functionality).
Unlike [refactoring](refactoring.md), optimization changes the behavior of the program to a more optimal one (but again, it doesn't change its functionality).
## General Tips'n'Tricks
These are mainly for [C](c.md), but may be usable in other languages as well.
- **Tell your compiler to actually optimize** (`-O3`, `-Os` etc.).
- **gprof is a utility you can use to profile your code**.
- **`<stdint.h>` has fast type nicknames**, types such as `uint_fast32_t` which picks the fastest type of at least given width on given platform.
- **Keywords such as `inline`, `static` and `const` can help compiler optimize well**.
- **Optimize the bottlenecks!** Optimizing in the wrong place is a complete waste of time. If you're optimizing a part of code that's taking 1% of your program's run time, you will never speed up your program by more than that 1% even if you speed up the specific part by 10000%.
- **You can almost always trade space (memory usage) for time (CPU demand) and vice versa** and you can also fine-tune this. You typically gain speed by precomputation (look up tables, more demanding on memory) and memory with compression (more demanding on CPU).
- **Learn about [dynamic programming](dynamic_programming.md)**.
- **Avoid branches (ifs)**. They break prediction and instruction preloading and are often source of great performance losses. Don't forget that you can compare and use the result of the operation without using any branching (e.g. `x = (y == 5) + 1;`).
- **Use iteration instead of [recursion](recursion.md)** if possible (calling a function is pretty expensive).
- **You can use good-enough [approximations](approximation.md) instead of completely accurate calculations**, e.g. taxicab distance instead of Euclidean distance, and gain speed or memory without trading.
- **Operations on static data can be accelerated with accelerating structures** ([look-up tables](lut.md) for functions, [indices](indexing.md) for database lookups, spatial grids for collision checking, ...).
- **Use powers of 2** whenever possible, this is efficient thanks to computers working in binary. Not only may this help nice utilization and alignment of memory, but mainly multiplication and division can be optimized by the compiler to mere bit shifts which is a tremendous speedup.
- **Write cache-friendly code** (minimize long jumps in memory).
- **Compare to [0](zero.md) if possible**. There's usually an instruction that just checks the zero flag which is faster than loading and comparing two arbitrary numbers.
- **Write [cache-friendly](cache-friendly.md) code** (minimize long jumps in memory).
- **Compare to [0](zero.md) rather than other values**. There's usually an instruction that just checks the zero flag which is faster than loading and comparing two arbitrary numbers.
- **Consider moving computation from run time to compile time**. E.g. if you make a resolution of your game constant (as opposed to a variable), the compiler will be able to partially precompute expressions with the display dimensions and so speed up your program (but you won't be able to dynamically change resolution).
- On some platforms such as ARM the first **arguments to a function may be passed via registers**, so it may be better to have fewer parameters in functions.
- **Optimize when you already have a working code**. As Donald Knuth put it: "premature optimization is the root of all evil". Nevertheless you should get used to simple nobrainer efficient patterns by default and just write them automatically.

3
pseudoleft.md Normal file
View file

@ -0,0 +1,3 @@
# Pseudoleft
See [left vs right](left_right.md).

3
right.md Normal file
View file

@ -0,0 +1,3 @@
# Right
See [left vs right](left_right.md).

View file

@ -0,0 +1,7 @@
# Slowly Boiling The Frog
*Slowly boiling the frog* is a phrase said to communicate the idea that people will tolerate a great change for the worse if that change is very gradual, even if they would absolutely not tolerate this change being made quickly. For example the amount and aggressiveness of brainwashing [ads](ad.md) and technological abuse that young people tolerate nowadays would have been absolutely unacceptable a few decades ago, but now it's the reality of life that few even question (some complete retards like that *linus tech* [faggot](faggot.md) even defend it).
The technique of slowly boiling the frog is used by [corporations](corporation.md), [governments](government.md), fascists and idiots to slowly take away people's freedom in small steps: each step takes away a bit of freedom while promising some reward, normally in form of additional comfort -- normal people are too braindead to see the obvious trick and are enthusiastic about the change. If you tell them that giving up [net neutrality](net_neutrality.md) or [P2P](p2p.md) encryption will eventually lead to almost complete loss of freedom, they label you a [tinfoil](tinfoil.md) or "conspiracy theorist", they tell you that "it's not a big deal". So it will go on with other and other changes and the normie is still happy because he can only see one step ahead or behind. The bad thing is that it's not only the normie who will suffer --in fact he may even be happy as a slave robot of the system -- but you will suffer as well. Normies decide the future of the environment we all have to live in.
Slowly boiling the frog works very well when spanning several generations because a new generation won't remember that things used to be better. Parents can tell them but young never listen to older generations, or take it seriously. A [zooomer](genz.md) won't remember that computers used to be better, he thinks that [bloated](bloat.md) phones filled with [ads](ad.md) and [DRM](drm.md) that don't work without Internet connection and that spy on you constantly are the only way of technology.