> Now, this is a time-memory tradeoff, but my time on this earth is limited so I decided to meta-program the if statements using a programmer program in a different programming language. for i in range(2*8): if i % 2 == 0: No comment...
4 billion if statements (2023)
31–40 of 183 posts
Re: 4 billion if statements (2023)
#32Earlier quoted context omitted.
You can do it even faster with the if statements: #include #include int main(int argc, char *argv[]) { if (argc \n", argv[0]); return 1; } char *s = argv[1]; int i; /* find the end of the string */ for (i = 0; s[i] != '\0'; ++i) ; /* make sure the string wasn't empty */ if (i == 0) { fprintf(stderr, "Error: empty string\n"); return 1; } /* last character is at s[i - 1] */ char d = s[i - 1]; if (d == '0') printf("even…
I'm disappointed, it's not in rust. :-)
Re: 4 billion if statements (2023)
#33 switch (v) {
case: 0,2,4,8,…:
return EVEN;
case: 1,3,5,7,…:
return ODD;
default:
return IDK;
}
Slightly less code to generate.Re: 4 billion if statements (2023)
#34 return odd_or_evenness[n];
works for me, alongside a pretty big array.Re: 4 billion if statements (2023)
#35kind of expected gcc to see right through the 300 gigs of code and compile it down to the tenish instructions.
> Lets compile the code, disabling optimizations with /Od to make sure that the pesky compiler doesn’t interfere with our algorithm
Re: 4 billion if statements (2023)
#36kind of expected gcc to see right through the 300 gigs of code and compile it down to the tenish instructions.
And that weird flag is because it's a windows compiler: cl.exe, not gcc.
Re: 4 billion if statements (2023)
#37> I saw from the SSD was around 800 MB/s (which doesn’t really make sense as that should give execution speeds at 40+ seconds, but computers are magical so who knows what is going on). If anyone knows what’s actually going on, please do tell.
Re: 4 billion if statements (2023)
#38If the author is available for consulting I have this bag of rice I need cooked. Should be around 30,000 grains, each needs about 1mL of water and 2m on the stove. Will pay $10 (2025 dollars)
Re: 4 billion if statements (2023)
#39If the author is available for consulting I have this bag of rice I need cooked. Should be around 30,000 grains, each needs about 1mL of water and 2m on the stove. Will pay $10 (2025 dollars)
Aha, you forgot to specify the country of those "dollars"! For $10 (2025 [Cayman Islands] dollars)! Which is higher than USD10
Re: 4 billion if statements (2023)
#40> Now, this is a time-memory tradeoff, but my time on this earth is limited so I decided to meta-program the if statements using a programmer program in a different programming language. for i in range(2*8): if i % 2 == 0: No comment...
How horridly inefficient, he should have just flipped a Boolean on each iteration.