3 ms·
> Just this week, I hit what seems to be an accidentally-quadratic bug in macOS's tail — tail! I'm not even sure how you write an accidental O(n²) in implementi
by stormbrew 4y ago
> Just this week, I hit what seems to be an accidentally-quadratic bug in macOS's tail — tail! I'm not even sure how you write an accidental O(n²) in implementing tail, but yet macOS tail takes 7 minutes to process a log file on my system that GNU tail can process in 80 milliseconds.
If you're curious you might be able to find out why for yourself:
https://github.com/apple-oss-distributions/text_cmds/tree/text_cmds-138.100.3/tail https://github.com/apple-oss-distributions/text_cmds/tree/te...
It's presumably based on an old freebsd (circa v3 or v4) version of tail.
(it's possibly you may already know this is out there, but it used to be a lot harder to find macos-related source code and they only recently put it all up on github so just in case)
- hnfong 4y agoThe easier way (or a supplementary way) would be to reproduce the slow situation, open Activity Monitor, choose the `tail` process and click "sample process". You'll get a stack trace.