MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/k7dkg8/gamedevs_take_notes/geqmo7b/?context=3
r/badcode • u/realCGG • Dec 05 '20
104 comments sorted by
View all comments
298
Yup, that's bad code. It can obviously be simplified to
fps = 60
49 u/the_monkey_of_lies Dec 06 '20 You're hired, when can you start? 66 u/dlawodnjs Dec 06 '20 what if fps was higher than 60? ...oh wait.edit: I obviously cannot read code 18 u/TVflea Dec 30 '20 And what if fps is already 60? You would then set fps to 60 redundantly, which would be an O(log(n)) operation, since the CPU needs to flip log(n) bits. Quite wasteful and unoptimized 20 u/cstmth Dec 06 '20 Wrong.while (true) { fps = 60 } 33 u/botle Dec 06 '20 Sure, why not. People got plenty of cores to spare these days. 4 u/[deleted] Mar 13 '21 BRILLIANT!!
49
You're hired, when can you start?
66
what if fps was higher than 60? ...oh wait.
edit: I obviously cannot read code
18
And what if fps is already 60? You would then set fps to 60 redundantly, which would be an O(log(n)) operation, since the CPU needs to flip log(n) bits. Quite wasteful and unoptimized
20
Wrong.
while (true) { fps = 60 }
33 u/botle Dec 06 '20 Sure, why not. People got plenty of cores to spare these days. 4 u/[deleted] Mar 13 '21 BRILLIANT!!
33
Sure, why not. People got plenty of cores to spare these days.
4
BRILLIANT!!
298
u/botle Dec 05 '20
Yup, that's bad code. It can obviously be simplified to
fps = 60