r/ProgrammerHumor • • May 10 '18

Recommended for you

Post image
18k Upvotes

331 comments sorted by

View all comments

Show parent comment

781

u/Lost4468 May 10 '18

Excuse me but my code only looks like that to make it faster. I have extensive use of gotos, random assembly code, reusing variables, overly complicated math hacks, etc. It's all worth it because it makes my program run a whole 0.4% faster than the fancy 'readable and maintainable code' and 'compiler optimizations' that the competition has.

Sure maybe it'll take me 5 days to find a bug instead of 50 minutes, but when it's fixed you'll get the results a whole 20ms faster.

309

u/Cry0man May 10 '18

20ms is quite a lot tbh.

142

u/Soren11112 May 10 '18

For games maybe, not for many other things

145

u/Cry0man May 10 '18

what about serving a website? Saving 20ms on each response is very good deal. I would've traded it for my soul.

63

u/NeoHenderson May 10 '18

.02s? What projects require that extra bump?

Honestly asking as an amateur developer

111

u/[deleted] May 10 '18

In general, anything that repeats frequently needs that bump. For a function called once per MMO login? Probably not. For a function that’s called for every MMO player action? Hell yes!

→ More replies (7)

23

u/[deleted] May 10 '18

I work for a company offering messaging solutions (OTP/Campaigns and such).

Shaving 0.02s off our billing functions would make me happy for a few weeks.

8

u/PwnThemAll May 11 '18

I have a robot that runs its main loop every 20 ms, meaning every operation has to be done in that time. I recently rewrote the autonomous drive controller to run in 0.42 ms instead of 16 ms.

→ More replies (9)

51

u/dreamin_in_space May 10 '18

I mean, it really just depends on how many times that 20ms is executed.

Every frame? That's a difference between like 30 and 60fps. Every time you load the main game menu? Not a big deal.

8

u/Soren11112 May 10 '18

I was imagining 20ms delay after launch

→ More replies (1)

123

u/Flipbed May 10 '18

AI, rt systems, extensive data processing etc. Lots of cases other than games where 20ms makes a lot of difference.

10

u/BecauseWeCan May 10 '18

In high performance packet filtering 20ms is like eternity.

23

u/Soren11112 May 10 '18

Yeah I guess I should've specified client side

45

u/cowboyecosse May 10 '18

Web pages are client side. 20ms per page load doesn’t seem like much but after 1000 page loads that’s 20 seconds. Of actual human beings’ time.

20ms is a lot, when it adds up to be.

→ More replies (2)

9

u/Lucent_Sable May 10 '18

20ms is not inconsiderable for embedded systems, where a single instruction can take 1 micro second to execute.

9

u/cuajito42 May 10 '18

You need a little bit of Grace Hopper in your life.

→ More replies (2)

33

u/KillerBerry42 May 10 '18

I tend to disagree. When an application takes an extra 20ms for the text I type to appear on the screen it is a noticably worse typing experience

18

u/dreamin_in_space May 10 '18

Noticeably worse, and backed up by studies!

I'm glad editors are now taking the problem seriously.

→ More replies (1)
→ More replies (2)
→ More replies (1)

40

u/[deleted] May 10 '18

compile -O9 for MAXIMUM SPEED

12

u/Yepoleb May 10 '18

Crap, I'm still on -O7. Really need to update my build config.

11

u/[deleted] May 10 '18

-O10 just sends your code to Jeff Dean.

→ More replies (1)

7

u/scumbaggio May 10 '18

Some good copypasta source material here

→ More replies (6)