Ok Jow Forums I've done it. Fastest C program for writing "nign" to a file 50000 times

Ok Jow Forums I've done it. Fastest C program for writing "nig\n" to a file 50000 times

#include

#define REP0(X)
#define REP1(X) X
#define REP2(X) REP1(X) X
#define REP3(X) REP2(X) X
#define REP4(X) REP3(X) X
#define REP5(X) REP4(X) X
#define REP6(X) REP5(X) X
#define REP7(X) REP6(X) X
#define REP8(X) REP7(X) X
#define REP9(X) REP8(X) X
#define REP10(X) REP9(X) X

#define REP(TENTHOUSANDS, THOUSANDS, HUNDREDS,TENS,ONES,X) \
REP##TENTHOUSANDS(REP10(REP10(REP10(REP10(X))))) \
REP##THOUSANDS(REP10(REP10(REP10(X)))) \
REP##HUNDREDS(REP10(REP10(X))) \
REP##TENS(REP10(X)) \
REP##ONES(X)

int main(void)
{
FILE* file = fopen("lol", "w");
fwrite(REP(5, 0, 0, 0, 0, "nig\n"), 1, 4 * 50000, file);
fclose(file);
return 0;
}


feelsgoodman

Attached: Y5DouduD.jpg (400x400, 27K)

disgusting unreadable code
0/10 see me after class

good work user!
we need more people like you

Attached: c87.jpg (600x902, 58K)

I am truly sorry that you cannot read pure and raw efficiency.

is fwrite faster than using fputc and doing it byte by byte?

reading and writing large chunks of data is always faster. Less function call, stack, system call overhead ect.

thank you

>loops unroll level: thousands
pathetic and cringepilled

And the C preprocessor also concatenates the string literals... Nicely done! But I wouldn't have UPPERCASED the macro args.

>doesn't write to stdout
>compiles to a 217KB binary

try this:

#!/bin/sh
yes nig | head -50000 > lol

Cringe and suck my cock. My program is almost twice as fast as your shitty fucking command. How about you suck my cock.

Attached: Screenshot 2019-04-25 at 01.36.32.png (1060x804, 955K)

in Haskell this is just
repeat 50000 ["nig"]

What slow piece of shit CPU do you have? I had to modify the program so it writes 5 000 000 times instead of 50 000 because 50 000 was too fast to benchmarks since time can't handle less than a millisecond. But yes your program is roughly twice as fast.

Once again C prevails, fuck off Rust fags, you could never do this.

>OS X
>How about you suck my cock.
You'd enjoy that, wouldn't you?

autism but the ok kind of autism

peak unix, linux and bsd btfo.

>using a shell made by a nigger
How about you fuck off to some other website?

lets see the code?

>Fastest
>Has no timing data

>fuck off Rust fags, you could never do this.
Upped it to 500k and I still don't see a difference, and the program on the right is actually a loop.

Attached: nig.png (1685x890, 155K)

the difference is C is based
rust isn't ¯\_ (ツ) _/¯
some languages are just meant to be for basedboys/women but that's ok there is nothing wrong with that so you keep doing what your doing.

>based
On what?

we have reached 100% peak shitposting with this thread

Attached: Screenshot_20180805-030312.jpg (1920x1080, 469K)

>fwrite
yikes, function calls are expensive user

What, you want him writing directly to disk using ports?

yes do it faggot

>C programmers actively reject using functions

makes a whole lot of sense honestly

>sub sp
>call addr
>add sp
yikes, how expensive

>not pushing and popping bp as well
Yikes.

you do that in the function silly user.

Attached: image0.gif (388x470, 807K)

>pushing and popping
Lewd

push your base pointer inside me, onii-chan~ n-no, not there!!

You are literally a nigger and rigged it. Suck my balls and get the FuuuuuuUuUUUUUuCk away

Look at that language syntax in the right, jesus fucking christ that's nigger speak if i ever saw any

I enjoy this solution more
echo "nigger\n" > nig.txt
:1
copy nig.txt nig3.txt
copy nig.txt nig2.txt
type nig3.txt nig2.txt > nig.txt
GOTO 1

terry's ghost saw my post!! i am so happy

>fast
>*outperformed with mmap and msync*

Attached: brainlets.png (1066x600, 276K)

Terry is that you

I can type faster than this

haha rust is gay and slow.

autism

>linux system calls
I prefer my nig printing function plantation independent, user.

Nice
Can you get a performance bump using preprocessor like OP did? Or some weird map function on an iterator to dump into the file in one go?

Fuck rust
Fuck niggers
Fuck faggots
and most of all
Fuck Jannies

Attached: 1556044882831.png (1024x768, 366K)

>A thread about how efficiently you can write "nig" continuously.
>Autistically arguing over .001 ms reduction in nig writes.

This is the best shitpost and worst autism I've ever seen.

Attached: cjs.jpg (902x600, 289K)

yeah but his code is twice as fast as yours so fuck off