The Bard's Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
JPDev@programming.dev to Programmer Humor@programming.dev · 2 years ago

Sleep() at home

programming.dev

message-square
11
link
fedilink
16

Sleep() at home

programming.dev

JPDev@programming.dev to Programmer Humor@programming.dev · 2 years ago
message-square
11
link
fedilink
alert-triangle
You must log in or # to comment.
  • EisFrei@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

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

  • bangupjobasusual@sh.itjust.works
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

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

  • Bronco1676@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    I just measured it, and this takes 0.17 seconds. And it’s really reliable, I added another zero to that number and it was 1.7 seconds

  • aksdb@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    On microcontrollers that might be a valid approach.

    • Darkassassin07@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 years ago

      But then I gotta buy a space heater too…

      • YIj54yALOJxEsY20eU@lemm.ee
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        2 years ago

        deleted by creator

        • towerful@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          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.

  • Dr. Moose@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    Javascript enters chat:

    await new Promise(r => setTimeout(r, 2000));
    

    Which is somehow even worse.

  • Darkassassin07@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    Tell the CPU to wait for you?

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

    • Kogasa@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      Have you considered a career in middle management

    • jaybone@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

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

      • leclownfou@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

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

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 178 users / day
  • 2K users / week
  • 3.99K users / month
  • 9.69K users / 6 months
  • 1 local subscriber
  • 30K subscribers
  • 1.52K Posts
  • 27.2K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.14
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org