Doesn’t a jump instruction screw up modern cache instruction fetching?
David H. Westacott
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> On
Behalf Of Vincent Burel (VB-Audio)
Sent: Thursday, May 31, 2018 3:53 AM
Subject: [wdmaudiodev] Re: SYSVAD source code has changed , not for the best.
“state of the art” methods (often similar to a kind of optimized simplicity)
remains valid for ever.
… and even today’s ARM processor might have not DIV instruction set.
A JUMP is 1 cycle instruction, in all cases it’s 20 or 30 time faster than a
Yes, I saw the concept of “m_ullLinearPosition” that is again very strange
(because not usable … this should be an offset directly).
PS: energy spent in audio processing is not trivial, it is really a subject,
because used as permanent process on billions devices, and costs a lot in term
De : wdmaudiodev-bounce@xxxxxxxxxxxxx <mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] De la part de Tim Roberts
Envoyé : jeudi 31 mai 2018 08:30
À : wdmaudiodev@xxxxxxxxxxxxx <mailto:wdmaudiodev@xxxxxxxxxxxxx>
Objet : [wdmaudiodev] Re: SYSVAD source code has changed , not for the best.
On May 30, 2018, at 11:59 AM, Vincent Burel (VB-Audio)
<vincent.burel@xxxxxxxxxxxx <mailto:vincent.burel@xxxxxxxxxxxx> > wrote:
Division is not used in DSP or Audio Real time programming (except if obliged –
in rare cases – some DSP has even not the DIV instruction available).
That may have been a rule in 1995, but it certainly no longer applies to
processors of the class that run Windows. It's micro-optimization.
So Why using division taking 30 or 40 cycles when you could just spend 2 or 3
cycles by a simple code like this below?
ULONG bufferOffset = m_ullLinearPosition;
If (bufferOffset > m_ulDmaBufferSize) bufferOffset -= m_ulDmaBufferSize;
Again, you have a comparison and a jump there. Jumps are anathema to modern
Intel processors. Plus, that has the implicit assumption that bufferOffset
will never be more that 2x m_ulDmaBufferSize.
PS: Someone can tell us the energy required to perform 40 cycles, 100 time per
second, on 2 billion computers, running 1 audio driver with 2 streams ?
Tim Roberts, timr@xxxxxxxxx <mailto:timr@xxxxxxxxx>
Providenza & Boekelheide, Inc.