There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

quantenzitrone , in Bug Fixing

i sometimes do that so i can inspect the error messages on a cleared terminal

winky9827b ,

Sometimes I forget what I was looking for and have to restart the mental loop when doing this.

Aceticon , in Bug Fixing

Well, duh! You need to use the right incantations!

DeepGradientAscent ,
@DeepGradientAscent@programming.dev avatar

All praise the Omnissiah, so on, and so forth.

TurboHarbinger ,

Something something motive force.

EisFrei , in Sleep() at home

Ah yes. The speedup-loop.
thedailywtf.com/articles/The-Speedup-Loop

tryptaminev ,

This is brilliant.

lauha , in Sleep() at home

I can relate. We have breaks ate work too.

bangupjobasusual , in Sleep() at home

I think some compilers will just drop that in the optimization step.

wreckedcarzz ,
@wreckedcarzz@lemmy.world avatar

Homer: “oh yeah speed holes sleep

jaybone ,

Sleep holes

ryannathans ,

Real pain in the ass when you’re in embedded and your carefully placed NOPs get stripped

vrighter ,

asm(“nop”);

Buttons , in Bug Fixing
@Buttons@programming.dev avatar

If that doesn’t work, sometimes your computer just needs a rest. Take the rest of the day off and try it again tomorrow.

Buttons , in The AI plugins in my IDE right now
@Buttons@programming.dev avatar

There was a research paper that took a variety of weaker LLMs and randomly asked each one to generate the next word, and it actually turned out really well.

Darkassassin07 , in Sleep() at home
@Darkassassin07@lemmy.ca avatar

Tell the CPU to wait for you?

Na, keep the CPU busy with useless crap till you need it.

jaybone ,

Fuck those other processes. I want to hear that fan.

leclownfou ,

I paid good money for my fan, I want to know it’s working!

kogasa ,
@kogasa@programming.dev avatar

Have you considered a career in middle management

ExtraMedicated , in Sleep() at home

I actually remember the teacher having us do this in high school. I tried it again a few years later and it didn’t really work anymore.

snaggen ,
@snaggen@programming.dev avatar

On my first programming lesson, we were taught that 1 second sleep was for i = 1 to 1000 😀, computers was not that fast back then…

aBundleOfFerrets ,

I mean maybe in an early interpreted language like BASIC… even the Intel 8086 could count to 1000 in a fraction of a second

snaggen ,
@snaggen@programming.dev avatar

This was in 1985, on a ABC80, a Swedish computer with a 3 MHz CPU. So, in theory it would be much faster, but I assume there were many performance losses (slow basic interpretor and thing like that) so that for loop got close enough to a second for us to use.

en.m.wikipedia.org/wiki/ABC_80

Matty_r , in Sleep() at home
@Matty_r@programming.dev avatar

This should be the new isEven()/isOdd(). Calculate the speed of the CPU and use that to determine how long it might take to achieve a ‘sleep’ of a required time.

henfredemars ,

I took an embedded hardware class where specifically we were required to manually calculate our sleeps or use interrupts and timers rather than using a library function to do it for us.

tengkuizdihar , in Bug Fixing
@tengkuizdihar@programming.dev avatar

Einstein did say…

drmoose , in Sleep() at home

Javascript enters chat:


<span style="color:#323232;">await new Promise(r => setTimeout(r, 2000));
</span>

Which is somehow even worse.

KairuByte ,
@KairuByte@lemmy.dbzer0.com avatar

I mean, it’s certainly better than pre-2015.

sbv ,

As someone who likes to use the CPU, I don’t think it’s worse.

vcmj , in Sleep() at home
aksdb , in Sleep() at home

On microcontrollers that might be a valid approach.

Darkassassin07 ,
@Darkassassin07@lemmy.ca avatar

But then I gotta buy a space heater too…

YIj54yALOJxEsY20eU ,

Microcontrollers run 100% of the time even while sleeping.

towerful ,

Nah, some MCUs have low power modes.
ESP32 has 5 of them, from disabling fancy features, throttling the clock, even delegating to an ultra low power coprocessor, or just going to sleep until a pin wakes it up again. It can go from 240mA to 150uA and still process things, or sleep for only 5uA.

YIj54yALOJxEsY20eU ,

Nah, Sleeping != Low power mode. The now obsolete ATmega328 has a low power mode.

kevincox ,
@kevincox@lemmy.ml avatar

I’ve written these cycle-perfect sleep loops before.

It gets really complicated if you want to account for time spent in interrupt handlers.

aksdb ,

Thankfully I didn’t need high precision realtime. I just needed to wait a few seconds for serial comm.

BigBenis , in Bug Fixing

The crazy thing is that sometimes this just works…

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines