3 ms·
> an uncontended mutex lock takes around 10-30ns depending on the machine. I am grateful for this. But I do wish the article had a few more comparisons like th
by quietbritishjim 7y ago
> an uncontended mutex lock takes around 10-30ns depending on the machine.
I am grateful for this. But I do wish the article had a few more comparisons like this, up to and including things much more expensive than exceptions, so readers could make their own decisions rather than just read about how terrible exceptions are.
As another data point, I just read that a Linux system call that does no actual work takes about 250ns, so about a fifth of the time for an exception from the article. Of course that's a totally unknown machine that could be much slower or faster than the one used for the article's benchmark. But I still found it interesting that they're the same order of magnitude – I hadn't expected exceptions to be quite that slow.
- je42 7y agoHerb Sutter also has presentation on this: https://www.youtube.com/watch?v=ARYP83yNAWk https://www.youtube.com/watch?v=ARYP83yNAWk