from Hacker News

Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%

by ylere on 4/10/23, 12:58 PM with 422 comments

  • by arnaudsm on 4/10/23, 5:46 PM

    Quick napkin math of the wasted power : Firefox has ~300e6 users, let's assume the bug wasted 5 extra watts 4 hours a day.

    That's 250 megawatts saved, the equivalent of an average coal power plant. Because some Microsoft engineer missed a bug.

  • by dgellow on 4/10/23, 5:39 PM

    > mpengine.dll version 1.1.20200.4 was released on April 4, so the fix should be available for everybody now. See the end of comment 91 to know what version you are using. Also, the latest discoveries in bug 1822650 comment 6 suggest that we can go even further down in CPU usage, with all antivirus software this time, not just Windows Defender.

    Really nice to see open collaboration between Mozilla and Microsoft development teams resulting in a net improvement for everybody.

  • by cronix on 4/10/23, 7:45 PM

    If you're on a Mac and using FF (probably not FF specific), turning off "ambient mode" in youtube can save 30% cpu. I just found this out while searching why FF was taking 90% of my cpu while watching youtube videos in normal mode, but went down to 40% use if viewing in full screen. Turns out that this youtube "ambient mode" was the culprit. My lap is now cooler and the fan doesn't turn on anymore. I wonder how much power I've wasted due to this new "feature" they added 6 months ago that I didn't know about.
  • by dang on 4/10/23, 11:24 PM

    Recent and related:

    Firefox engineers discover a Windows Defender bug that causes high CPU usage - https://news.ycombinator.com/item?id=35458746 - April 2023 (215 comments)

    Is the current post significant new information* or just a repeat of that submission?

    * https://hn.algolia.com/?dateRange=all&page=0&prefix=false&so...

  • by NelsonMinar on 4/10/23, 6:30 PM

    It's so frustrating this discussion took five years.

    I'd be grateful for an overview of the bug. I don't think I've seen it on my two systems but I can't be confident.

  • by jeffbee on 4/10/23, 5:03 PM

    That's one way to look at it, but a very biased take. An equally valid take is that Firefox was calling an expensive platform feature too often, and even though it has been killing performance for years (possibly, for the entire history of the project) nobody noticed or bothered to fix it on the application side.
  • by whalesalad on 4/10/23, 5:43 PM

    My only interaction with Windows Defender is the (undefeatable) nag popup every boot that warns me it is disabled.
  • by neilv on 4/10/23, 6:26 PM

    When I've heard people speak of changing Web browsers in recent years, I think the two most common reasons given are performance and privacy.

    I wonder whether this situation with Microsoft Defender cost Firefox some market share.

  • by somid3 on 4/10/23, 8:40 PM

    Conspiracy theory — could this have been done on purpose for browser share dominance purposes?
  • by Animats on 4/10/23, 6:54 PM

    How fast would this have been fixed if was Microsoft Edge that was wasting CPU time?
  • by NelsonMinar on 4/11/23, 2:44 PM

    Interesting comment on Reddit from a Mozilla engineer: https://www.reddit.com/r/firefox/comments/12hxqjl/comment/jf...

    Careful to talk about how this is entirely a fix for Windows and will improve the experience of folks using other software, not just Firefox.

  • by MuffinFlavored on 4/10/23, 4:52 PM

    What apps other than Firefox might this have affected that badly (75% CPU usage)?
  • by nabakin on 4/10/23, 7:36 PM

    Firefox-related CPU use is only reduced by 75% when this bug is caused. NOT in the general case as this title implies
  • by jiggawatts on 4/10/23, 10:11 PM

    Looks like there's more work left to do to catch up to Chrome: https://bugzilla.mozilla.org/show_bug.cgi?id=1823634

    That bug is more subtle. Apparently the various ways to use VirtualAlloc is not self evident, and some variations have wildly different performance characteristics due to undocumented interactions with Event Tracing for Windows (ETW) events that get sent to anti virus products.

    So it's not only the original problem of the events being handled inefficiently, it's also that the way they're generated is a bit of a black box and hard to predict without detailed performance tracing work.

  • by dbg31415 on 4/10/23, 9:55 PM

    I have screamed about this like a crazy person and filed bugs and was always told, "Meh there's nothing there..."

    But if you use Firefox to call yourself on Chrome... you'll see that Firefox takes up a TON more energy on an Intel MBP than Chrome does.

    You can tell because Firefox literally heats your laptop up to do streaming videos. You hear the fans kick on, the laptop gets hotter to hold.

    Anyway I'm sure there are more bugs like this! Glad Firefox is getting some of the people to fix their code... but look, Microsoft isn't the only culprit. Until Firefox takes as little power as Chrome in MacOS & Windows... I think we should all stay outraged! (=

  • by tcfunk on 4/10/23, 5:42 PM

    I wonder if this is why Firefox often gets killed when I have other high-resource apps open?
  • by qikInNdOutReply on 4/11/23, 8:01 AM

    Good thing its a bug though, not a monopolistic attempt to sabotage the competition running on your platform, by doing strange things with API rodeo. This surely ruined the performance of other software too..
  • by mmis1000 on 4/11/23, 2:16 AM

    Guess that's why I never feel firefox laggy but others said it is. The first thing I do after installing windows is always installing some other antivirus to disable defender. Because the defender start routine scanning at weird time and lag games randomly, which is really annoying.

    I really have no clue why engineer at ms think such behavior is ok. Shouldn't scans like these scheduled at some time slot that people are not actively using computers?

  • by gtop3 on 4/10/23, 4:54 PM

    I would like anyone that considers Microsoft to be a recent champion of Open Source to reflect on corporate doublespeak. It's plausible that this bug was engineered as an attack on Firefox.
  • by nnurmanov on 4/11/23, 2:19 AM

    Someone should create a website to list bugs that haven’t solved for years. Hall of shame. I myself could add couple from Oracle, hibernate
  • by nabakin on 4/10/23, 7:24 PM

  • by shadowgovt on 4/10/23, 8:41 PM

    Woof, that's a long time for a bug like that to have sat around and Mozilla to not have come up with a workaround for it.
  • by xyst on 4/11/23, 6:32 AM

    yet another reason why I don’t touch Windows for any professional/sensitive workflows.

    Only keep a license around for the occasional gaming session. Disable all of the Windows features (ie, firewall, auto updates, antivirus) and telemetry. Strip the OS to bare minimum and manage the GPU, mobile drivers manually. Limit it to only games

  • by subarctic on 4/10/23, 7:19 PM

    When you say reduced by 75%, would that mean, say, going from %40 to 10% or from 75% to 0%?
  • by taeric on 4/11/23, 2:47 AM

    I feel like this could/should be a metaphor for airport security...
  • by pomsense on 4/10/23, 11:13 PM

    Most likely their devs using GPT4 and finally "fixed" it
  • by PaulHoule on 4/11/23, 5:55 PM

    It’s hard to say that anti-virus isn’t worse than the virus.
  • by wankle on 4/11/23, 2:37 AM

    Someone diverged the thread into Linux vs Mac. The point is, how did the evil Microsoft monolopy get away with not fixing this bug for so long.
  • by Brosper on 4/10/23, 6:22 PM

    Wow Microsoft should say at least sorry to Mozilla and somehow repay them for this!
  • by crest on 4/10/23, 5:41 PM

    "bug"
  • by GrumpyNl on 4/10/23, 7:27 PM

    maybe AI helped them out.
  • by MagicMoonlight on 4/10/23, 7:05 PM

    “Bug”
  • by andrewstuart on 4/10/23, 6:30 PM

    DOS ain’t done till lotus won’t run.