News for hackers. Stuff that matters.
Re:The slow currentTimeMillis() by amluto on Friday August 04, 2017 @10:42AM (#14928993)
It's worse than you might think. There are at least three things happening 2000x/second: getting an interrupt, writing shared memory, and returning. Getting a CPU interrupt takes something like 1k cycles. Dealing with the APIC may be even worse on a system without X2APIC, which is all too common due to crappy firmware (never benchmarked it, though), and returning takes many hundreds of cycles because x86 is very bad at these things. That shared memory write is n basically free unless NUMA is involved, and then it can be fairly bad.

So we're taking maybe 4M cycles per second used here. In practice, there's probably quite a bit of extra software overhead.

There are no comments on this comment yet.