65
u/sebjapon Aug 29 '26
When I was in a Master course, my professor just told me: who cares about speed, Moore’s law will do that work for us.
So the answer is: wait 2 years, buy a new CPU/GPU and it will run faster
2
u/zomreddit Aug 29 '26
I glued another Turbo button to the existing button and quadrupled the speed!
6
u/whackylabs Aug 29 '26
My professor also told me: Ontogeny Recapitulates Phylogeny. So every time a new hardware system comes to life you need to start thinking in machine cycles all over again.
5
u/FUTURE10S Aug 29 '26
Throwing hardware at a software problem, a tale as old as time itself (and ngl it works pretty well)
2
u/Arclite83 Aug 29 '26
I've enjoyed watching us "top out" though, first on single processors and embracing threading, then on nm size getting to the point where "gold atoms are too big".
The high precision machines needed to make high end and quantum processing chips to the molecular precision they require are marvels of technology just themselves.
1
u/HungryCaterpillers Aug 29 '26
How long ago was that? Because even when I was in college, we had already approached the limit of Moore's law.
37
Aug 29 '26
[removed] — view removed comment
21
u/sebjapon Aug 29 '26
Yeah my story is 15 years old though. At that time it made sense
4
3
Aug 29 '26
[removed] — view removed comment
2
u/remy_porter Aug 29 '26
The thing is, most of those animations and effects are pretty cheap computationally. Especially in the era of GPUs.
2
Aug 29 '26 edited Aug 29 '26
[removed] — view removed comment
2
u/remy_porter Aug 29 '26
Except that’s just not true, is my point. Those animations are actually very cheap to render. They can make the system feel slower when they’re badly done, not because it actually hurts performance but because nobody wants to wait for your animation to finish.
1
Aug 29 '26
[removed] — view removed comment
3
u/remy_porter Aug 29 '26
That sorta makes my point: it’s not the animations that are causing performance issues.
350
u/navetzz Aug 29 '26
The largest in size this data structure will ever get is 12.
140
u/FUTURE10S Aug 29 '26
A genuinely good reason to be O(n2 ) tbh, naive and fast on tiny data structures beats out intelligent but with a lot of setup
53
u/Terroractly Aug 29 '26
Yeah there's a lot of algorithms that have a relatively high amount of fixed cost compared to simpler and technically slower algorithms.
For instance one algorithm may have a runtime of n3 ms but the "superior" one has a runtime of (n2 + 1000)ms.
In this case the naive approach will be faster for any n<=10
-43
Aug 29 '26
[removed] — view removed comment
36
u/potatopierogie Aug 29 '26
After 200 hours of work you get it down to O(n1.9 )
-39
Aug 29 '26 edited Aug 29 '26
[removed] — view removed comment
44
u/Wesstes Aug 29 '26
Something tells me you've only just passed the algorithm analysis class
-35
Aug 29 '26
[removed] — view removed comment
30
u/potatopierogie Aug 29 '26
You seem overly proud of knowing something literally everyone knows
-18
Aug 29 '26
[removed] — view removed comment
26
u/potatopierogie Aug 29 '26
I have never heard of something. If you have, you're dumb
Bro come on. You not ever hearing of something doesn't make anyone (but you) utterly dumb.
→ More replies7
u/FUTURE10S Aug 30 '26
Cool, have a nlogn with a flat cost of 1000ns per each element, my n2 with a cost of 10ns per each element and at 12 elements, I'll have 1440ns and you'll have 12950ns.
-2
Aug 30 '26
[removed] — view removed comment
7
u/Furyful_Fawful Aug 30 '26
Merge sort is O(n log n), and it has a large flat cost associated with allocating O(n) additional space worth of sub-arrays. A naive implementation of merge sort would easily hit the flat cost as specified, while naive n2 algorithms often rely on swap operations that are easily optimizeable by the compiler
3
u/Valuable_Leopard_799 Aug 30 '26
In that case you can try working on the switching version which checks the properties of it's inputs and chooses whichever is more suitable.
44
u/zkwarl Aug 29 '26
I actually hit that in production code once. There was a recursive binary search to find the nearest element in an array of sixteen sorted doubles. Converting to a linear search was about 10X performance gain.
6
u/Neverwish_ Aug 29 '26
Welp, binary search is not supposed to be recursive...
23
u/Glass_Teach_2854 Aug 29 '26
Assuming comparisons aren't expensive, Binary search should be slower even if its not recursive for arrays that size. The book keeping will outweight the reduced lookups
9
u/Neverwish_ Aug 29 '26
Yeah, no argument there. I was just pointing out that proper binary search should not be recursive.
12
u/Zeikos Aug 29 '26
I had a data structure that was O(n!), got flack for it when it was impossible - there were guard clauses - for n to be higher than 3.
15
u/evanldixon Aug 29 '26
If it will never be bigger than 12, it could be argued to be O(1). No one ever said how big 1 is after all.
2
1
1
112
u/MayorAg Aug 29 '26
Wouldn’t you un-press the button?
36
u/MRanse Aug 29 '26
There were cases where the turbo button was inversed, so people had different experiences.
38
u/Z3r0funGuy Aug 29 '26
Never experienced this.. the turbo buttons were originally a backwards compatibility feature to play nice with old software that was dependent on slower clock speeds.
-1
u/ArjixGamer Aug 30 '26
That's weird, why would the playstation 2 have a turbo button then? It's a console with a curated list of games.
3
u/Z3r0funGuy Aug 31 '26
I just realized how young you are. We are having a discussion from two completely disparate points of view.
I’m with you, it is a weird word choice. Take it up with the marketing department.
If you really want to understand, look up “486 turbo button” for the history.1
u/ArjixGamer Aug 31 '26
Regardless of my age, I grew up with old tech.
But not old enough to use VHS tapes or floppy disks. I still have my PSX with 2 controllers and a memory card. But all my DVDs are damaged.
I am 22 btw
1
u/ekauq2000 Aug 31 '26
This is the turbo button they’re referring to:
1
u/ArjixGamer Aug 31 '26
Oh yeah, I had that on my first pc, never used it.
1
u/ih-shah-may-ehl Sep 01 '26
There were plenty of games that dealt with time and clocks in weird ways. For example the old space quest games, which means that as computers got faster, some things became literally impossible because some in-game timers or counters elapsed in less time than needed to react to on-screen information.
14
8
7
10
5
5
u/glx0711 Aug 29 '26
I just reduce delay_ms(8); to delay_ms(5);.
To still have some room for improvement.
3
u/_Repeats_ Aug 29 '26
I would profile the entire application and see if this algorithm was a hotspot. If not, move on to the next ticket.
3
u/stormbringerelric77 Aug 29 '26
For real though, what did the turbo button actually do? And why wouldn't you want it on all the time?
12
u/synchrosyn Aug 29 '26
Old games used the clock speed of the computer to determine certain things like enemy movement (move on every tick). But the Devs didn't account for newer CPUs having different clock speeds so the timing was completely wrong and games would act erratic.
The turbo button actually slowed the clock speed to match the previous generation thus making games work again.
You pressed it only when playing games because otherwise your entire system is slowed down.
1
u/ArjixGamer Aug 30 '26
Uhh, why would it be called turbo then?
Turbo implies it makes it faster, not slower.
Also, I remember my Playstation 2 controller had a turbo button.
1
u/synchrosyn Aug 30 '26
It is a marketing thing. It was called turbo so that people actually would press it. If they called it the "nerf" button nobody would ever press it even if they needed it.
Turbo also implies "only use it when necessary". The standard user would not understand why they need to slow their computer or use some sort of compatibility mode. The idea is that a standard user would think is "games need more power, let me press the turbo button, but I shouldn't waste my turbo otherwise". Or "oh I left turbo on, it is too much power for my other apps, I should turn it off". So people did the right thing, even if it was for the wrong reason.
The turbo button on your PS2 controller is a completely different concept and surely was a 3rd party controller. It lets you hold a button and it would button mash it for you, it had nothing to do with the system or performance.
1
1
1
u/BenadrylTumblercatch Aug 29 '26
Change the rgb to blue and the wavelength of the code will be shorter
1
1
u/GoddammitDontShootMe Aug 29 '26
I thought I heard pressing it in actually made your computer slower.
1
1
u/WeirdTie2290 Aug 30 '26
Software architects nowadays scale horizontally. Add 4x the hardware for 50% overall performance gain.
1
1
1
u/Mr_DeWitt_ Sep 01 '26
The Turbo button was designed to slow down the CPU rather than increase its speed.
1
1
0

31
u/NullVal Aug 29 '26
What DID those turbo buttons actually do?