PSA: Catalina Spotlight is broken (calculator –> excessive load)

So these past few days I’ve noticed unusual CPU spikes that led to a really hot and loud MBP. Hella load appeared to be coming from mds_stores. It took me a while to figure out that I was actually causing that myself.

I use Spotlight a lot as a calculator since it’s always just cmd-space away from whatever I’m doing and my hands never need to leave the keyboard. Turns out, in Catalina when you invoke calculator functionality from Spotlight you send it on some crazy loop that leads to near 100% load courtesy of the mds_storage process. I was wondering if perhaps I had configured something in an odd fashion (I restrict quite heavily what Spotlight is allowed to search), but it turns out others have stumbled on this issue as well. And apparently it’s a bug in Catalina Spotlight where for some reason Spotlight has trouble parsing entries as algebraic statements to send to calculator which then leads to the excessive load.

Apple’s “Community Specialist” was apparently quite useless (offering the generic Spotlight re-indexing, SMC reset, yada yada). Looks like this will require an actual patch from Apple. Anyway, in case anybody else is noticing excessive load from mds_stores this is what might be triggering it.

Work around right now: a) immediately after calculating a result delete it so Spotlight stops trying to parse the statement, b) move to Siberia and consider hot MacBook a feature or c) get out my trusty old HP-15C and use that instead of Spotlight. Prefer RPN anyway. :wink:

https://discussions.apple.com/thread/251263130

2 Likes

Or use a calculator app (PC Calc anyone) or the calculator from the control panel on your iPhone.

Thanks for the heads-up—and for the tip that Spotlight can be a calculator. I did not know that.

Fully concur.

Or, if you don’t want to install a third-party product, just use the macOS calculator app

I find even colleagues of mine at work often don’t know about that (lots of engineers, lots of calculators) and ask in surprise when they see me use Spotlight for a quick calculation during a meeting. It’s incredibly practical because it’s always there, there’s zero load time, and you can just continue typing, no mouse ever needed. Cmd-space, calculate, esc, done. (granted if you want the calc preserved you have to mouse out instead of using esc). Love it. Considering how useful it is, I’m always a bit stunned not everybody already knows about it.

The one thing I’d like added is if it could somehow be tweaked to support RPN statements (I hate having to ctrl-a and ctrl-e to set parentheses in the middle of the calculation). The built-in macOS Calculator supports RPN and since I’m pretty sure that’s what Spotlight is using as a backend, I’d think it’s only grammar and parsing that’s missing. Maybe just too much of a nerd feature for anybody to put real time into.

That’s what I normally do, but unfortunately it’s broken, at least compared to what I consider to be the gold-standard HP calculators. One example is pressing the key for pi. That dutifully puts the value of pi in the bottom register, but a following numeric keystroke overwrites it. Far worse, pressing the pi key overwrites the contents of the bottom register. There are a few other deviations from my HP calculator, and it is really annoying to be in the middle of a calculation and lose work because the Apple calculator couldn’t be bothered to raise the stack.

Maybe it’ll be fixed on the ARM-based Macs.

FWIW, I’m not seeing that here. I tend to use LaunchBar as a calculator in this way more, so that might be worth a try for you.

Likewise, I use Alfred for quick calculations in the same way, it is always one hot-key away. On an iPad or other users machines I use spotlight.

1 Like

I always dismiss Spotlight by pressing cmd-space again. I didn’t even know esc was an option! Advantage of cmd-space to dismiss is that it’s often a lot quicker because the keys are nearer your hand. But it also doesn’t clear what’s in Spotlight. I often calculate, cmd-space to dismiss, check something, then cmd-space to go back to the calculation.

(As a side note, I never use the esc key as I also find cmd-. to be a lot more convenient because of key placement, and it’s in my muscle memory from the Classic days when esc rarely/inconsistently worked.)

Reported the bug to Apple. Although I cannot imagine they weren’t already aware.

No, but as you’ll read in an upcoming article, duplicate bug reports are essentially votes to have the bug fixed. So they’re always worth making.

Do these reports need to come from different users? I’d be happy to set up a script bugging them about it daily. :wink:

Heh. Yeah, they need to be from different people or at least separated in time. As you’ll learn, the bug reports made via Feedback Assistant go into a separate database from the Radar bug database that the engineers use, and must be evaluated and moved manually. So all you’d be doing with a script is annoying some low-level engineer, who would probably take it out on you by refusing to transfer any of your bugs.

I just learned today that indeed it does not show in some instances. If the expression is complex load tends to get pegged. If the expression is very simple, like 1+2, Spotlight soon after displays not just the correct result under Top Hit but also starts listing documents below that contain the expression. As soon as that list appears, the load goes away. But if you take a more complex expression, like (1-e^(-.25/60/4))*500, Spotlight will not list any documents below Top Hit (at least in my case) even seconds later and in that case the max load stays pegged.

1 Like

Aha! Yes, if I enter that equation into Spotlight, mds_stores goes bananas for about 10 seconds before everything settles down again. What’s weird is that the answer comes up immediately, and it takes mds_stores 10-15 seconds before it spikes the CPU.

I believe that’s because for some reason Spotlight somehow fails to stop parsing as a search query even though it’s already recognized it as algebraic statement.

To be perfectly honest, I wouldn’t count on Apple ever fixing this. I can’t imagine that calculator usage is a high priority for the Spotlight dev team.

But then, I rarely use Spotlight myself, because I’ve always found it to be clunky as an actual search engine, often returning results that I can’t figure out how they relate to my actual search terms. Anything for which I can use other tools, I do so.

As for an always-accessible calculator, I used to use Numi 2, but it doesn’t appear to play nice with Catalina. So right now I use Alfred, which I initially was using primarily as an app launcher before I began discovering all the other nifty things it can do, instant-on calculator being one of them.

https://www.alfredapp.com/

Or you can just keep a terminal window open with python running (doesn’t matter much that Macs have 2.7 by default)

    • (45. / 7.)**(1./2.)
      10.1418510567422

import math
math.hypot(3,4)
5.0

math.factorial(12)
479001600

Unfortunately you do need to put in the decimal points throughout for things like the first example, but that’s an easy habit to form if you do it enough. There are also scads of calculator programs written in python for the command line. Test them first, many are student projects…

You can install SciPy and get not only get better calculating, but symbolic math, graphing and much more:

https://www.scipy.org/

You can install Sage, which is even more comprehensive than SciPy, or use the free cell server (no account needed, but it’s heavily used and slow). IIRC there’s also a Sage iOS app that connects to the server.

https://www.sagemath.org/
https://doc.sagemath.org/html/en/a_tour_of_sage/index.html
https://sagecell.sagemath.org/

Or, you could do something completely different, and use the APL tutorial website. It’s a bit like TECO, for those old enough to remember that: cryptic and powerful. (But it leaves out the “dangerous”.) For anyone who gets hooked, Dyalog APL is free for non-profit individual use. (Commercial APL interpreters are stupidly expensive, because the primary user is the insurance industry.)

https://tryapl.org/

Game of Life in APL (about 7 minutes):

https://www.youtube.com/watch?v=a9xAKttWgP4

2 Likes

The actual workaround is to just remove the calculation from the Spotlight search field after completion.

But that is just a workaround. Of course what Apple really should do is fix what is quite obviously just another bug. That way the workaround will no longer be necessary.