Sabitlenmiş Tweet
Simplex
19.6K posts

Simplex
@simplex_fx
AAA gamedev for 15+y (ex-Crytek). Automotive stuff. CNCing old turret lathes. Writing a game in C. Father. Catholic. Swordsman/stunt.
Sukoró, Magyarország Katılım Şubat 2013
583 Takip Edilen1.9K Takipçiler

if you consider basic bit operations like idx & map "obfuscating", you shouldn't go near C or C++ or any kind of system / perf / embedded / mission critical code.
I assume you piss on your legs when you see a "De Bruijn" bitscan or a Q_rqsrt
Svetlin Totev@SvetlinTotev
@simplex_fx So your solution to the performance problem of comparing two numbers and doing a conditional branch that only happens when there is a catastrophic bug is to: - Double the operations, memory loads, cache lines, code length, memory used; - force 2^n array sizes; - obfuscate logic.
English

@simplex_fx You cannot write an entire useful program without branching
English

@ashrealite @SvetlinTotev test terniary / cmov
should be almost as fast as & (at least on desktop/mobile)
English

@simplex_fx @SvetlinTotev from my testing, the generated code is around 15% slower if the array is not pow2 and you are doing modulo, because it generates constant division optimization for that operation which is basically a wide mul, shift(sometimes with add), a mul and sub, and that's constant
English

@simplex_fx Ah my bad I thought you were talking about actual software
English

@simplex_fx This is genuinely, actually the most retarded thing I have ever seen on this platform. No, no serious team lead will let you merge code that behaves in functionally random ways when there is an error. I hope to god that you never actually pick up C.
English

@SvetlinTotev @Dark_Goldenrod what kind of sw you write for a living fucktard?
English

@simplex_fx @Dark_Goldenrod Your reply is completely unrelated to what I said because you don't actually know or understand anything. You just misuse interesting looking one-liners because they make you feel smart. You will not learn and you will not get better until you realise you are like this.
English

A real C dev never need bounds, you retard.
uint idx = someidx();
foo[idx & mask] = bar;
Stefan@schteppe
C dev about the lack of bounds checking:
English

@SvetlinTotev @dollmanipulator assuming you hw even has branch prediction.
English

@dollmanipulator @simplex_fx The expected number of mispredicts is 0 because you are checking something that will never happen.
Also my point is that the OOB should be handled correctly and never completely bypassed. And this can be done without a check at every calculation.
English

@SvetlinTotev @simplex_fx Btw, you don't even need to limit it to pow2, because the compilers are smart.
For example modulo the size of the array would optimize down into some constant time ops as well and prevent the branch allowing SIMD.
Pow2 size just guarantees that op is a simple as a bitwise &.
English

@SvetlinTotev @Dark_Goldenrod if you find basic bit ops confusing just use a fucking cmov and stfu
English

@Dark_Goldenrod @simplex_fx In a hashmap, every key is valid. In an array, only some idx are valid. Also the memory allocations are designed around being able to use the lower bits of the hash directly.
So this idea doesn't work in general for arrays both because of the size problem and the idx problem.
English

Never go full retard.
I got past printf debugging when I was 12..
Strace@straceX
printf is still the best debugger ever made.
English

I’m more of a just “do not check” guy.
Like, really, we want to make sure that index is never out of bounds, like provably not possible. And then do not check.
If that is not feasible, like data from disk, user input, etc. then you must check and abort if fails, so branch is unavoidable.
Using mask is retarded.
English

@simplex_fx Gameplay on the GPU. Completely get rid of the CPU pipeline stage. As a one man show Im not building linear play-through content with scripted interaction. All those game design methods that only scale by hiring count won’t work.
English

@SvetlinTotev if you consider basic bit operations obfuscating, you shouldn't go near C or C++ or any kind of system / perf / embedded / mission critical code
English

@simplex_fx So your solution to the performance problem of comparing two numbers and doing a conditional branch that only happens when there is a catastrophic bug is to:
- Double the operations, memory loads, cache lines, code length, memory used;
- force 2^n array sizes;
- obfuscate logic.
English

@P88044770 why don't you already have this infrastructure for logging?
English

@simplex_fx Temporary debugging prints shouldn't need such infrastructure. I'm talking about a handful of lines being output.
English

@simplex_fx More like I have majority of code on the GPU in shader land, so live edit/test, and everything bound in all dispatches, so I can build visualizer tools like say a scope, and just write data to the source buffer at any point in time from any shader.
English