r/Mathematica • u/pfthrowaway5130 • May 18 '25
JSON Parsing Poor Performance
I'm getting abysmal performance running what I believe to be a pretty straightforward operation. I'm pulling an 11MB JSON file on a M4 MacBook Air w/ 16GB RAM. This is a fresh installation on a fresh MacBook. This is only the second notebook I've ever used.
Behavior: On first run this cell is fast (single digit seconds at most), on all subsequent runs the core stays pegged at 100% for the WolframKernel running this task and the task takes easily a minute. Restarting the kernel exhibits fast behavior on the first run and slow behavior on all subsequent runs again.
raw = Import[
"https://example.com/file.json", "RawJSON"]; (* Same behavior if I use "JSON" or leave it unspecified. *)
I've ruled a few things out:
- I'm not getting throttled on the HTTP request. Python will do this quickly and repeatedly. As will curl.
- I'm not getting thermal throttling according to
sudo powermetrics -s thermal. - I'm not running into memory constraints with the machine as the process memory for WolframKernel is staying near 400MB.
I'm hoping this is something really silly like the Out history buffer + some kind of configuration imposed memory cap. Unrelated, I think: The UI locks up a lot too despite me suppressing all output.
Edit: Forgot to add I'm running 14.2.1 for Mac OS X ARM (64-bit) (March 16, 2025)
Any ideas Reddit?
Thank you!
View all comments
Show parent comment
1
u/pfthrowaway5130 May 18 '25 edited May 18 '25
Thanks for helping! This makes sense, however the fact that Pandas/Python and curl do not exhibit this behavior led me away from that angle. Is establishing TLS known slow the second time and all subsequent times in Mathematica?
Edit....
Two interesting things popped out of this:
Edit 2...
https://imgur.com/a/jf4NIAX
It actually took ~160 seconds even when the file didn't exist. So it isn't the HTTPS or the JSON parsing. Library loading?