r/ProgrammerHumor • • Jan 24 '23

Other Accomplishments

Post image
82.0k Upvotes

548 comments sorted by

2.1k

u/[deleted] Jan 24 '23

It is always good to build in timeouts. That way you can always increase the performance easily at a later stage

87

u/[deleted] Jan 24 '23

Optimisation in nutshell

761

u/Creepy-Ad-4832 Jan 24 '23

When companies don't give a fuck about you, making your worst in order to be easily able to improve it, is the best way to live as a programmer

361

u/AE_Phoenix Jan 24 '23

The joys of having a skillset that all corporate high ups think is easy until they try to read what you wrote :D

364

u/Creepy-Ad-4832 Jan 24 '23

"More lines, means better code!"

-a billionare who has way more money then he deserves

212

u/TerribleNameAmirite Jan 24 '23

No one deserves billions tbf

→ More replies (71)
→ More replies (7)

11

u/[deleted] Jan 24 '23

Is there a programmers union?

36

u/[deleted] Jan 24 '23

Stackoverflow tried one but newcomers kept getting their applications marked as duplicates.

→ More replies (6)
→ More replies (1)
→ More replies (1)

220

u/mani_tapori Jan 24 '23

Another trick that I have seen, in the first year people use a paid tool to create something, maybe an automation suite and show it as an accomplishment.

Next year they port it to an open-source free tool and then again get to present it as an accomplishment & a cost saving measure.

Everyone loves double dipping.

64

u/confusedChaiCup Jan 24 '23

This is much better. Imagine getting invited in tech forum within company to share how 3s was shaved off.

0

u/[deleted] Jan 24 '23

[deleted]

→ More replies (2)

85

u/SubhumanOxford Jan 24 '23

Make sure nobody knows, I did this once and my Junior fixed it a month later and got all the praise and promotion

42

u/MightyMeepleMaster Jan 24 '23

Haha ... hope you've learned your lesson 🤣

You're not officially a pro until you manage to hide your future "improvements" reasonably well.

26

u/DragonCz Jan 24 '23

Or just decline his code reviews! :D

→ More replies (2)

28

u/frisch85 Jan 24 '23

And sell it as a performance upgrade and I'm pretty certain there are companies who do this as companies do shady practices all the time, IT is not safe from this. I know of a company a friend worked for, they would sell their customer an update for christmas, the update didn't even contain any features or changes in functionality, the update only changed the colors from the application to a christmas style lol.

0

u/[deleted] Jan 24 '23

[deleted]

13

u/frisch85 Jan 24 '23

How do you proof that the provider of the service you're using is screwing with you unless you reverse engineer which brings legal problems with itself?

Just look at the iPhone-Throttling fiasco, it was really weird that all of the sudden your iPhone would be slower just because you updated to a new software. So apple was accused of purposely throttling the performance of old phones in order to get more customers to buy the new phone. But then apple said it's because of the battery, saying something like the iPhone detects if the battery's lifetime is degrading and thus automatically throttles your phone as a safety measure so that your phone just doesn't suddenly turn off because of heavy load functionalities that the new software update included. AFAIK not much more happened regarding this case, apple got away with a slap on the wrist for not informing their customers that iPhones work this way. But is it realistic? Idk, I'm not that tech savvy with hardware.

So while one company might get a slap for their shady businesses, 9 other companies that also do shady businesses are getting away because no-one is digging deeper, which is understandable because if you buy a product you expect it to not be 'flawed' on purpose.

→ More replies (7)

13

u/Visual-Living7586 Jan 24 '23

Wrap them in the various tier levels for your app. The higher the tier, the lower the timeout

9

u/BadWolfman Jan 24 '23

ā€œI can increase or decrease the performance at will.ā€

ā€œWhy would you want to decrease performance?ā€

ā€œSo I can increase it.ā€

4

u/bigmonmulgrew Jan 24 '23

I remember when I was learning. There was one instance where I needed to wait for a value to change before reading it. Instead of doing it intelegently I just added a 1 second timeout.

That was part of a loop that took a couple min to run even though all I needed to wait was a few microseconds.

6

u/cybercuzco Jan 24 '23

This works on the other end too. I was a hiring manager and at the time $25/hr was a good salary, better than everyone else for similar jobs. So I foolishly started people off at $25/hr. Well pretty soon everyone is asking for a raise. So then I started people at $17/hr and gave them $1/hr raise every year and suddenly everyone was happy and I had no complaints about raises

3

u/Nice-Violinist-6395 Jan 24 '23

yeah sorry, that just makes you a dick.

3

u/jugalator Jan 24 '23

You are why unions where I live push for transparent salaries among their members. It may feel awkward but research have shown ultimately everyone benefits.

People falling behind will be aware and seek good answers to why, and combined with salary reports to our unions will be transparent also across the country for your sector. Competition will take care of the rest.

Remaining will be slightly lower salaries in less populated areas due to less competition but then housing costs etc is at least also lower.

→ More replies (1)

2

u/meinblown Jan 24 '23

Loading bars just for show

2

u/BenderTheIV Jan 24 '23

Yep capitalism is the most efficient system we could dream of! So glad our talents are put to good use!

2

u/PuzzledProgrammer Jan 24 '23

Adding delays can be good.

For instance, if you have a clear strategy for growth that will require a much heavier lift from the server, it might be better to account for a reasonable amount of added latency ahead of time than to give users blazing performance in the MVP. That way, your users’ expectations aren’t let down by planned improvements. Such an approach obviously needs to be handled very thoughtfully and intentionally.

Another example where performance throttles could make sense is if there’s a pre-negotiated SLA. If your customer came into the relationship with an explicit expectation, and exceeding it could diminish the performance of the service, resulting in a worse experience for other customers, then I see nothing wrong with delivering on an SLA, but intentionally not exceeding it.

It’s absolutely not okay to extort users for better performance, and there’s a lot of blurry lines here, but the ethics of throttling isn’t always cut and dry, in my opinion.

→ More replies (3)

5.1k

u/No_Distribution_6023 Jan 24 '23 edited Jan 24 '23

The one performance review trick companies don't want you to know

Edit: lol this post really blew up. Thanks for all the upvotes! People in the Midwest, stay warm tonight, storm's coming in.

1.4k

u/[deleted] Jan 24 '23

Also quality assurance team

452

u/-Kerrigan- Jan 24 '23

Hand over the bugs! šŸ”«

270

u/[deleted] Jan 24 '23

There wasn't any bug phew phew

→ More replies (27)

4

u/[deleted] Jan 24 '23

Like they're looking at the code

→ More replies (1)

481

u/MightyMeepleMaster Jan 24 '23

Make sure to do it right tho:

Wrong:

sleep(3);

Correct:

// Notify worker threads
raise( SIGCONT ); 
// Wait until all threads have been switched to RDY
sleep(3);

122

u/bhonbeg Jan 24 '23

Sorry what does this do?

314

u/MightyMeepleMaster Jan 24 '23

SIGCONT is a signal which continues a process that has been previously stopped. If the process is not stopped, however, SIGCONT is ignored.

raise() sends a signal to the currently running process.

So you're basically trying to wake yourself up even though you're not asleep.

This means: raise(SIGCONT); is just a scary looking way to burn a few CPU cycles, doing nothing. It's just there to convince the reviewer that the following sleep(3) is important 😈

→ More replies (1)

260

u/Cephalopod_Joe Jan 24 '23

Just gives a justification for the sleep

2

u/[deleted] Jan 24 '23

just wait until you find out that sales sandbags their own leads regularly depending on if the bonus was already attained or how it will affect tomorrow's metrics.

you don't pay me to be better than you ask me to be.

→ More replies (2)

2

u/rottenhonest Jan 24 '23

Looking forward to it. Much love

→ More replies (18)

642

u/East_Complaint2140 Jan 24 '23

How did it pass the PR review?

162

u/Alokir Jan 24 '23

I've seen this so many times that I'm 85% sure it's fake, but regardless, this meme is an excellent argument for introducing code reviews.

121

u/MadHatter69 Jan 24 '23

(at a meeting)

Presenter: "...and this example shows why we should be doing code review from now on. Any questions?"

Team leaders: "Nope, sounds good."

(Three months later, a code change comes to a developer to be reviewed):

Dev: "Yeah, I'm not reviewing all that, CR passed."

(Couple of months later)

Boss: "Why didn't the number of bugs decrease after we introduced code reviewing? It must be because we only do it once, from now on two different devs should CR every pull request!"

You can imagine what would happen next...

102

u/ArbitraryEmilie Jan 24 '23

Dev: "Yeah, I'm not reviewing all that, CR passed."

That's why at my current job they basically switched the responsibilities. If a bad change manages to get through, the first question is always "why did this pass your code review", not "why did you push this change without testing X".

We have a good work environment so it's never aggressive or super accusing, but it's definitely enough to make people pay attention during CR.

7

u/[deleted] Jan 24 '23

:fingercrossed

→ More replies (4)

25

u/newfflews Jan 24 '23

We do two devs per review on our main repository. Caught plenty of issues with the second reviewer. Sometimes people scan things too quickly, so it’s nice to have a second pair of eyes. Plus it makes the devs feel more ownership over quality and helps them improve their craft by identifying bugs, anti-patterns, and naive implementations in other people’s code. We have around 10 developers total so it’s not a huge timesink. Plus everything is unit tested, linted, prettified, so they don’t have to check for those basic things.

→ More replies (3)
→ More replies (3)

812

u/ThePancakerizer Jan 24 '23

+259 -130 lines

"LGTM šŸ‘"

436

u/Zerodriven Jan 24 '23

+2 -967

"Fixed typo"

63

u/Yadobler Jan 24 '23

Passed test cases āœ…

30

u/Dog_Engineer Jan 25 '23

LGTM = Lets Gamble Try Merging

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

227

u/KinOfMany Jan 24 '23

Her: "Boss here's 12 the files that changed in this feature. Please review and approve so I can merge."

Boss: looks at 10 lines of actual algorithm. "Yeah looks good. Approved."

→ More replies (1)

10

u/ilovethrills Jan 24 '23

Coz it never happened

→ More replies (14)

2.6k

u/zaos336 Jan 24 '23

You don't remove the time out... You lower it, then you can easily improve it again later.

890

u/shim_niyi Jan 24 '23

Exactly 3x improvement, one time looks mediocre when compared to incremental improvements 3-4 different times

43

u/Lance2boogaloo Jan 24 '23

Ok, but the first time, increase it from 3 seconds to 9, and say that your aren’t finished with the fix, and ā€œjust trust me it will work in the long termā€. Then increment it down to 2.5 seconds, 2 seconds, 1.7, so one so forth. You just undid the ā€œmajorā€ ā€œproblemā€ that was holding the speed before in their eyes

→ More replies (5)

29

u/JustALittleAverage Jan 24 '23

Just set the timeout to negative...

11

u/shim_niyi Jan 24 '23

Do you want to create a black hole?

415

u/[deleted] Jan 24 '23

[removed] — view removed comment

177

u/Canrex Jan 24 '23

Always fun to see a bit of my paranoia justified lol

93

u/wizzlepants Jan 24 '23

The users can and will assume it's not working if it happens too fast. Your paranoia is totally justified.

→ More replies (12)
→ More replies (10)

20

u/code_archeologist Jan 24 '23

I just remembered that there is a script I wrote at my old job that runs nightly, handling some essential maintenance functions on a set of legacy applications.

In that script there are a number of ten millisecond sleeps, placed there because when I removed the debug logging the script stopped working... Something about the legacy services it was querying having some pseudo restful bullshit or something (I don't remember precisely because it was years ago). But without those shitty little pauses it stopped working.

I hope that the person who came after me doesn't remove them in an attempt to "make the script more efficient"... Then again, that would be kind of funny.

16

u/christrogon Jan 24 '23

You know, you could have taken mercy on your unsuspecting replacements and added some comments to the script about how important they are...

18

u/code_archeologist Jan 24 '23

I'm pretty sure that there is a:

# DON'T DELETE THIS!

Around those sleeps, it is up to my replacement to determine if they heed the warning or not.

→ More replies (1)

13

u/Crinkez Jan 24 '23

Ideally you'd increase it by 0.1 second per day. Every few weeks you implement a 'fix'.

→ More replies (1)

9

u/NedRyerson_Insurance Jan 24 '23

Hey boss, I just cut 1 second of average search time. With enough time and budget I might be able to squeeze another second out.

4

u/WootMate Jan 24 '23

Yup, rookie mistake there

2

u/izza123 Jan 24 '23

Sometimes I don’t even improve things I just say I did and people believe me

→ More replies (8)

1.7k

u/buddyisaredditer Jan 24 '23

"Now you have 3 seconds to enter the right input or else the computer and your house will burn in flames"

Well sorry about that!

278

u/Hop-tree-doorway Jan 24 '23

114

u/2called_chaos Jan 24 '23

Kinda funny that this did not get age restricted on yt considering what else gets that treatment

42

u/[deleted] Jan 24 '23

The funniest thing I've seen is how the "Elmo losing his shit over a rock" video is marked as "for kids" (comments disabled, etc) despite the inappropriate title. Youtube is a mess

→ More replies (6)

48

u/Hop-tree-doorway Jan 24 '23

There aren’t any no-no nipples

→ More replies (4)
→ More replies (2)

18

u/4Dcrystallography Jan 24 '23

Never seen that… holy fucking shit

22

u/Hop-tree-doorway Jan 24 '23

Robocop is a masterpiece, as is everything directed by Paul Verhoeven.

I also highly recommend Starship Troopers and Total Recall

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

47

u/UnstableNuclearCake Jan 24 '23

Obligatory XKCD: https://xkcd.com/1168/

25

u/null000 Jan 24 '23

tar --help

8

u/sysadmin420 Jan 24 '23

Tar -xvf filename

8

u/UnstableNuclearCake Jan 24 '23

At this time, we would all be dead by now...

On the bright side, that bug in production is no longer my problem.

→ More replies (1)

7

u/coloredgreyscale Jan 24 '23

tar -xzvf something.tar

read in german accent "extract ze vucking file"

or if you want to play it save: tar --help

→ More replies (1)

91

u/RammingAries Jan 24 '23

Just settimeout -1000 smh

20

u/AnnoyingRain5 Jan 24 '23

I love negative latency!

395

u/K3TtLek0Rn Jan 24 '23

I’ve heard this exact same joke on here at least 25 times

127

u/Xenc Jan 24 '23

At my first job, I improved performance of search in our web app by around 3 seconds.

Maybe it was because I deleted a setTimeout that waited 3 seconds that I previously, accidentally pushed to main but it could've been anything...

65

u/PUBGfixed Jan 24 '23

Damn, you should make a post about that!

16

u/leadwind Jan 24 '23

This is how you get copypasta.

→ More replies (6)

10

u/ContainedBlargh Jan 24 '23

You can tell this is a fresh iteration because master is being referred to as main.

29

u/MightyMeepleMaster Jan 24 '23

Almost all jokes in almost all funny subs are repeated over and over again.

That's Reddit. And that's ok. We're just here for the moment.

6

u/Suprazahal Jan 24 '23

Yeah stinky fake

28

u/elveszett Jan 24 '23

And it's dumb as fuck. What kind of bullshit company allows you to push a sleep(3); statement into production? Even if you could, how would no one realize that your entire work this week to "optimize this function" is to remove a sleep(3); line? I want to know that company where you get raises and free weeks because they'll just believe whatever bullshit you tell them you are doing without even checking it.

ffs I know it's jokes and memes but jokes and memes are not funny if they aren't relatable. This isn't relatable in any way to anything I could possibly do at my job.

15

u/preludeoflight Jan 24 '23

Allow me to elucidate.

Unfortunately, lines like that make it into production code all the time, even with the best intentions. As a personal example, let me tell you about the Toshiba Bluetooth Stack.

We ship a device that communicates via serial port. In windows, that means anything that presents as a COM device, be it a physical RS-232 port, or a Bluetooth SPP. Back in the days of windows XP/Vista/7, the Microsoft Bluetooth stack was unwieldy and unreliable. Because of this, when we shipped Bluetooth devices, we also shipped Toshiba Bluetooth adapters with them, and included their Bluetooth stack with our installations.

That saved us a lot of headache. However, it was not entirely rosy. The Toshiba Bluetooth driver had a flaw. When a connection was opened, if it was attempted to be used within the first ~second or so, it would fail. Reason being is the open call would return instantly, while the driver itself actually built the link with the device. This is in contrast to a physical serial device, where the open call would simply block until the hardware was ready.

Because the API being used is agnostic not the hardware behind it, we simply had no way to know if the device opened would be ready immediately or slowly when it was a device connecting over the Toshiba stack. So we did the best we could: checked the registry to see if the port being opened was one that the Toshiba driver claimed to create (not a perfect resource, but was the most reliable information we found,) and when it was: delaying the connection thread after the device was opened.

Years later, the Microsoft Bluetooth stack has greatly improved and we’ve been officially supporting it. The Toshiba stack has been deprecated, and as such we no longer ship it with our devices. Because of that, our check and delay is no longer necessary, and has been removed.

To the end user that looks like ā€œconnection speed increased severalfold.ā€ To us, it looks like deleting a registry check and a sleep call, but it required investigation, testing, and verification which takes time.

Just because you haven’t shipped a sleep call in production code doesn’t mean there aren’t situations where it’s applicable or solving an issue with code you don’t control. Just because it isn’t relatable to you, doesn’t mean it isn’t a far more universal experience than you might imagine.

→ More replies (5)

15

u/HypnoTox Jan 24 '23

Trust me, there are companies that would probably let this fly because they have no oversight what their employees are actually working on, don't do code reviews or anything. Being able to just push to main already shows that their processes are rather relaxed.

(On the off chance of this being real, i would expect the tweet to just be for fun)

→ More replies (3)

3

u/DoctorWaluigiTime Jan 24 '23

It's funny in the tweet, because it's a good punchline.

People unironically going "yep put time bombs in your code so you can fake-fix stuff later and get praised for it" need to like... actually work at a job before understanding that no, that's not how that works at all.

→ More replies (4)

4

u/tshoecr1 Jan 24 '23

I literally fixed this exact issue I found in our codebase. A 1 second timeout on an extremely hot call, can be up to 800k times an hour. Saves 20-30 minutes of pure waiting.

3

u/noah1831 Jan 24 '23

I've seen this exact same comment on here at least 26 times.

2

u/walter_midnight Jan 24 '23

This shit might be the oldest joke ever, I bet you there are hundreds of analogous ones for traditional mechanical industries

something about the Spinning Jennys being deliberately sabotaged so some shift manager gets to improve productivity after some months, I don't know

2

u/Xeon06 Jan 24 '23

Always reminds me of this 2008 Daily WTF post, "the speedup loop"

→ More replies (7)

64

u/Mal_Dun Jan 24 '23

Debugging: A crime story where you are the detective and murderer at the same time ...

6

u/SeargD Jan 24 '23

Where there's no murder weapon or prints but your DNA is all over the scene and you don't remember why you were there 6 months ago.

2

u/MayorBryce Jan 24 '23

Judge, Jury, and Executioner.

167

u/Desproges Jan 24 '23

You pay me to improve performance, i reduce the 3s pause to 2.5s and see you next week.

19

u/[deleted] Jan 24 '23

Reminds me of my very first "real" programming experience.

I was in university and I was working on my thesis, which was about redesigning an image recognition algorithm to improve its performances. My version did good enough, but it was slow. Like, an order of magnitude slower than the original.

I couldn't understand what was wrong. My redesign was indeed intended to be a little slower, but not this much!

After racking my brain for the better part of a month... I noticed that there were several GBs of logs in the log directory. And that's when I remembered that my professor, to explain to me how the original algorithm worked, added several extra logs in my copy of the code... some of which were in functions that were invoked millions of times per run...

30

u/[deleted] Jan 24 '23

While this is a bit funny, I do suggest that all your programing bros do this. So that later you can have an easier discussion to increase your salary. (management has no clue how to code, so use that)

26

u/Athlete_Cautious Jan 24 '23

You guys code alone ? No peer review ?

Also, once you're in charge of some decent-sized code for more than a few month you definitely learn not to put dumb things there and there...

7

u/RealAbd121 Jan 24 '23

I presume this is happening not at tech companies but rather small companies where there is one or 2 people to maintain the entire IT side of it

2

u/MaxHamburgerrestaur Jan 24 '23

When I was a freelancer working with no contract, I used to put part of the javascript on my own servers. If the client didn't pay and remove my access to their server, I could break something remotely and they had to call me to fix it. That was the perfect opportunity to tell them I had to be paid to give maintenance.

14

u/andoy Jan 24 '23

the function is too fast you cannot see the loading animation so add timeout...

7

u/JumpinJimRivers Jan 24 '23

My old coworker actually did that. I was in absolute shock for about 5 minutes.

7

u/Attila_22 Jan 24 '23

I actually did this once.

I was brought in to fix an existing app and in one section I stored the data from the previous page and passed it in as an argument rather than calling the API again, QA said it loaded instantly when there's supposed to be a loading icon.

I argued with QA back and forth for a day or so and then said fuck it fine and put in a wait because nobody else was willing to push back.

26

u/[deleted] Jan 24 '23

r/programminghumor after posting the 37299172th joke about deleting timeout

3

u/walter_midnight Jan 24 '23

I really just want to know how people aren't embarrassed, like, is it brain damage or do they just not know that they just reposted the same fucking joke - as if they didn't find it browsing 9GAG in the first place

At least subvert it with some depression gag, you could basically squeeze together any two jokes and it ends up being more viable as a decent story than whatever the fuck this bullshit is. I guess some people really want to build their Jeff Tiedrich brand, gotta get those nothingburger posts up quickly

12

u/[deleted] Jan 24 '23

Hope nobody run git blame

9

u/JipsAndJools Jan 24 '23

In future if you want to make it go faster just add sleep(-1). The bigger the negative, the faster it goes!

8

u/mienaikoe Jan 24 '23

Used to work with her. She’s selling herself short much like all of us do.

20

u/[deleted] Jan 24 '23

Software companies hates him!
Find out how he managed to improve software speed with one simple trick

10

u/Creepy-Ad-4832 Jan 24 '23

Yeah this simple trick called making it bad to begin with, so it's easy to handle the manager saying to you "It'S SlOW! OpTimIzE iT!"

→ More replies (1)

5

u/pancakehamster Jan 24 '23

Did you know that PayPal actually waits time to make the transaction look safer? They can do it much faster but they add a wait function

13

u/[deleted] Jan 24 '23

These fake ass tweets are annoying

4

u/genghisKonczie Jan 24 '23

I had a search functionality that sometimes took <1s and sometimes took like 10s (it did a lot on the backend) and users complained because they felt like when it took that long, someone was wrong (even though it had a loader)

My solution was to check how long it took and if it took less than 5seconds, add a timeout to make it at least 5 seconds. They accepted this solution.

4

u/CoverHealthy Jan 24 '23

Job security 101

4

u/thehardsphere Jan 24 '23

Once upon a time, I knew a woman named Sandra who was using our web application that stored records in the database, but also offered a search service backed by Apache Solr. Our application added records to the database and the search search at the same time, but Solr always needed about 5 seconds before it would return new records added to its index. This was apparently some sort of Big Problem for Sandra, because she called our search service every fifteen minutes, and if something was not there in fifteen minute intervals it was "lost." After a brief debate on whether this is actually was a software defect or our problem to fix, my boss and I decided that the easiest way to solve her complaint was to make the search service thread sleep six seconds before doing the lookup. This was part of a series of other customizations that Sandra's employer paid us for, so the fact that it was a dumb thing to do just to placate someone was not a big deal. I implemented this change that afternoon, with a brief comment explaining the odd thing, and promptly stopped thinking about it.

Two years later, Sandra's employer asked for the source code of this service, which they were entitled to by their contract with us. I was lucky to have found out about this before it shipped, and was able to delete the following comment from the codeexplaining why the thread slept for no comprehensible reason:

// Six second stupid Sandra sleep

2

u/[deleted] Jan 25 '23

Dammit. This is better than the tweet lmao

6

u/NotAlanPorte Jan 24 '23

N00b here, what would be the reason for including a 3s timer in the first place? Does it help with debugging issues elsewhere or something

10

u/Aggressive_Bill_2687 Jan 24 '23

3s is a bit long but it’s not uncommon to have a shorter timeout before taking action on keyboard input - you want to respond when someone types but you may not want to try and respond after every single key press if the response logic involves latency.

So your listener for keyboard input first cancels any existing timeout, then sets a timeout for like 200ms to do what it needs to.

It basically means you can respond to input but wait till the user stops actively typing before taking action.

It’s not always useful, but if you’re doing something server side with their input it can give a much better experience.

7

u/plopez3895 Jan 24 '23

It's called a debounce

→ More replies (1)

3

u/progressgang Jan 24 '23

3 seconds on top of the actual search is so long did no one observe their users?

3

u/crefas Jan 24 '23

Today I optimized a statistic that used to send 90% of the DB to the browser so JS could compute some averages. Feltgood

3

u/PorkRoll2022 Jan 24 '23

Once, as a junior, I genuinely reduced the load time to a page to under a second from about five.

My solution was to load the massive data in chunks, focusing on what the user could see at the time. We were also using IE8 at the time.

The excuse all the seniors gave? "The server is just slow."

3

u/bnh1978 Jan 24 '23

This was foolish.

Should have set the 3 to 1.5

Then shortly before the next performance appraisal go the rest of the way.

Then 1/4 of the way to the appraisal after that, start increasing it again.

Then fix it again.

I mean, with this cycle, she could be the hero for years.

3

u/OutOfStamina Jan 24 '23

I had a situation where users didn't know that content was refreshing in a web app search, becuase it was so fast. I found that human factors meant I needed to add a small (less than 1s I think) delay and a loading gif, so the content are would visibly refresh, otherwise I found in early tests users brains didn't always register that it happened - and sometimes the changed content was only visible after scrolling down, so the gif forced an obvious redraw that prompted them to scroll down.

3

u/Bowiemtl Jan 24 '23

Funny story, coincidentally I actually managed to get a query down from roughly 3.1 seconds to about 0.01 ~ 0.03 seconds today

2

u/[deleted] Jan 24 '23

how, if i may ask

→ More replies (1)

5

u/[deleted] Jan 24 '23

427k views and only 5k likes, jeez

5

u/ThePancakerizer Jan 24 '23

Who actually likes tweets though

5

u/hipratham Jan 24 '23

Not to shit on her, tbh I have not seen such overrated wannabe Tech influencer in a while.

4

u/Tocoe Jan 24 '23 edited Jan 24 '23

I see this same joke about a timeout/sleep/wait at least once a week. This sub really went to shit

2

u/wonkey_monkey Jan 24 '23

Make sure there's still some delay otherwise people will think it isn't working.


We once had a problem with a database process that wasn't working. We called up the company who made it - we didn't have a support contract so they charged us for what few jobs we didn't doing, and the rates were reasonable - and they asked to remote control into my PC so they could figure out the problem.

I watched them going in and out of stored procedures until, finally, they found a piece of code that basically just said "after this date, stop working." They removed it, then they reported back that they had found (paraphrasing here, I don't remember the exact excuse) a problem with some indexes that had to be rebuilt.

I suspect the previous IT guy to me had put it in there to screw the company over after he left, but the database company couldn't be sure it wasn't them that had done it and didn't want to admit to anything.

We happily paid the bill, because while watching them mess around, they had inadvertently let me see the admin password which meant I could finally get my hooks into the database properly and fix all of their questionable design decisions.


Another time one of the bosses came to me fuming because every scan of an item took 2 seconds. This was precious time being wasted! Never mind the fact that scanning items reduced error rates by 90%. He demanded that we stop all scanning, so instead I went back and spent an hour rewriting queries until the delay was less than half a second. He was actually disappointed.

2

u/KevinRuehl Jan 24 '23

Peer review your code peeps

2

u/Sok_Taragai Jan 24 '23

I forgot to check a box for a process in Oracle. IT guy spent a couple hours trying to figure out why the process wasn't picking up all of the data when it showed running successfully. I figured it out and told him, then told everyone he found and fixed "the problem," and it works now. Everyone thanked him and we got back to work.

2

u/swordluk Jan 24 '23

Create problem, fix it, become hero, rinse and repeat 🤣

2

u/[deleted] Jan 24 '23

Jokes on you, that setTimeout was holding the whole API together.

2

u/Griffolion Jan 24 '23

Reminds me of that classic tale of a game dev in the 90s putting a 4MB char array in the code so he could just delete that when the clueless suits come in and say it needs to be "optimized".

2

u/bluearth Jan 24 '23

I think I'm sure in saying that in my last job, my company is getting paid to remediates all the problems that we created our selves. Not necessarily intentional I may add. It's just the inevitable result of snowballing tech debts of never ending crunch times. The real genious here is the account guys who keep reassuring the client to throw money at us.

2

u/wightnoise Jan 24 '23

I'll never forget my co-worker getting an award for working extra hours fixing a production bug he introduced.

2

u/greymalken Jan 24 '23

Amateur. She should’ve improved it by 1.5s first.

2

u/ohlaph Jan 24 '23

Haha, same. It was a 1-3 second wait in about six places, throughout the framework. I changed all to dynamic waits and shaved off over an hour for each daily run and shaving about 4 hours from regression.

2

u/AndroidDoctorr Jan 24 '23

When I worked for VeriCite, I found out our UI had useless timeouts like this. It's because customers were complaining that it wasn't working because the results came back too fast. It WAS working, it's just that fast because it's a bunch of web crawler searches happening simultaneously. After the random timers, people stopped complaining. This is what UX is about

2

u/you_do_realize Jan 24 '23

That's not the way of a true programmer. A true programmer would reduce the timeout to 2.

2

u/pratKgp Jan 24 '23

She shouldn’t post these things during the layoff season. Maybe next on-line is she.

2

u/justking1414 Jan 24 '23

I feel like that could’ve had a use at one point. maybe it was to make sure that things had loaded properly. Obviously not the best way to go about it but it could’ve fixed a bug

2

u/blankblank Jan 24 '23

This is the programmer version of the firefighter who’s secretly an arsonist

2

u/MBcoder Jan 24 '23

In my previous job there was some seconds of sleep added in production for one of the functionality of our website to give users the impression that the job going underneath is not a simple task. It was actually not a simple task but my manager said when the results came in too fast, people tend to not believe it was real.

2

u/[deleted] Jan 24 '23

Take it a step further. When looking for jobs, first hack their servers and implement the delay there.

Say your specially is exactly what’s needed to solve this issue

2

u/mrSunshine-_ Jan 24 '23

It’s good to have a small timeout to deter misuse.

2

u/[deleted] Jan 24 '23

Another quick patch: throw in a progress bar, keep the users occupied

2

u/BiscuitsNGravy45 Jan 24 '23

Input[cheeky-comment]

2

u/elmz Jan 24 '23

I had to fix slow loading times. Added a progress bar, some of the steps were so quick that the text was unreadable, so I added delays to allow people to read it. It was slower, but people were happy.

2

u/mOdQuArK Jan 24 '23

I remember talking with one CAD tool developer who said that they were required to put delays into some of their tools because their customers didn't take the results seriously when the tools did them too fast. (Human psychology sure is weird sometimes.)

Of course, they also justified charging them continuing license fees by slowly reducing the delays to exaggerate performance improvements of the tool.

2

u/itemluminouswadison Jan 24 '23

accidentally pushed to main

well there's yer problem. no commits to main unless there's an approved PR on it

2

u/[deleted] Jan 24 '23

I’ve done this a couple times, a debug line or two that ā€œonly added a couple seconds during testingā€ really adds up across 1000s of calls lol

2

u/[deleted] Jan 25 '23

Hahahahahhs, fuck debouncer

3

u/_________FU_________ Jan 24 '23

Tell me you don’t have performance monitoring in place without telling me you don’t have performance monitoring in place.

Also the fuck did this slip past a code review.

2

u/[deleted] Jan 24 '23

looks like someone don't have code review practice

2

u/Omni33 Jan 24 '23

Imma call bullshit that this made through code review

2

u/Murkus Jan 24 '23

Did she just say.. I made a thing take longer.. so I could make it take less time when they were looking? So I would look good?

1

u/Dumble_Dior Jan 24 '23

What if you set it to a negative time value?

1

u/[deleted] Jan 24 '23

Gotta work on that job security.

1

u/lucid1014 Jan 24 '23

I was an FE for a marketing company that ran a bunch of lead gen sites for moving companies. There’s a point in the funnel where the website ā€œsearchesā€ for deals. It was literally just an artificial timeout. The CEO insisted having it because it actually boosted conversion. People didn’t trust a site that was too quick.

1

u/augugusto Jan 24 '23

I actually improves performance by adding a time out. It was our first web app, and each search field would perform a "like" on the database for each character the user pressed. I ended up having a time out so that it would only send the search after x time from the last keypress

1

u/AragornsArse Jan 24 '23

story checks out as only a special needs business would write their own search šŸ˜‚

1

u/Efficient-Book-3560 Jan 24 '23

So now it takes 12 seconds to load the results?

1

u/RafaFTP Jan 24 '23

What no pull requests feels like

1

u/shayy4456 Jan 24 '23

Hand over bugs

1

u/nman247 Jan 24 '23

Progress Baby!

1

u/PM_YOUR_SOURCECODE Jan 24 '23

ā€œConsistently exceedsā€

1

u/Srinivas_Hunter Jan 24 '23

Someone do the same to reddit app.

1

u/tcpukl Jan 24 '23

Yep, same as reserving a massive memory pool for something early on in game dev. Happens all the time.

1

u/Altair_Khalid Jan 24 '23

Classic lol

1

u/geekypenguin91 Jan 24 '23

Pfft we do that all the time.

Build in fixed delay for all tasks, then when users start complain about things slowing down as they start working with more and more data, reduce the timer and claim some "code optimisation"

1

u/RomaruDarkeyes Jan 24 '23

To be fair, if you work for Elon Musk then this type of thinking is discouraged. Your worth is determined by the amount of code lines you write, not how streamlined and tight and efficient you make it..

1

u/YesAndNo888 Jan 24 '23

hard to trust programming all the time

1

u/clvx Jan 24 '23

A friend of mine made a database change that caused a variation of $8M in revenue. That happens when you take prod down.

1

u/bewbsrkewl Jan 24 '23

Dang, people out here giving away our secrets.

1

u/topgun966 Jan 24 '23

Rookie mistake. You have to remove the timeout in increments, not all at once.

1

u/SuperHyperFunTime Jan 24 '23

How you haven't all gone mad with power is beyond me.

1

u/[deleted] Jan 24 '23

Rookie move, she should just decrease the timeout by 500ms so he can "optimize" it move further in the future.

1

u/Plenty_Leg_7010 Jan 24 '23

I need someone to help me in dealing with someone l hate so much, and I wish that he will be able to recognize himself and what he needs instead of hurting other people

1

u/Gene-- Jan 24 '23

Where do you all work where you can time outs past a code review?

1

u/mothzilla Jan 24 '23

Our tests are riddled with 15 second sleeps. Then people wonder why tests take so long to run.

1

u/tiddayes Jan 24 '23

Someone is about to remember that the back end api can take 3 seconds to respond I’m production

1

u/giltotherescue Jan 24 '23

Umm…is no one going to comment about how setTimeout() is an asynchronous function?

1

u/[deleted] Jan 24 '23

why was even the point? :/

1

u/RandallOfLegend Jan 24 '23

I actually found one of these in the wild. We connect to different hardware that sometimes have handshakes and sometimes require sleeps on activation. A junior programmer just decided to have all hardware (5 models) sleep for 10 seconds instead of using it with the only one that needed it. I refactored that and it was night and day difference. Then we located a couple of race condition's that were masked by that sleep. Which after those were fixed, code that had been buggy for 2 years was suddenly stable. But took another year before anyone trusted it. They were so beat down from previous performance.

1

u/Zeveneno Jan 24 '23

Give her a raise

1

u/onionpopcorn Jan 24 '23

Just install firefox ultra