Getting a 50KHz output rate using just 40% CPU time is impressive.
I remember writing a 4-voice polyphonic synth for a 6809 machine years ago and shaving away every cycle I could just to get an 11KHz output rate. I bet you're really enjoying yourself
Yes, if i would not be enjoying it i would stop at once
You had one thing right. Hacking Lance is now on top of the 40 % limit for all mods @ 50 KHz with the new version 9A.
This version is in all almost identical to version 9 except in the Protracker handler.
That piece of code was improved in a way that could also be done on Amiga:
- organize CPU registers and give each of them one general task;
- take out all mulu/muls/divu/divs;
- take out all possible sp save/restore of registers;
- improve the finetune note index search;
- use a datastruct for the main mod variables;
- keep in the main branchs of the code flow only the possible effect cases;
Finally the specific Amiga stuff was commented: Filter and FunkIt (because of the way loops are played on ST that code would not work as it is and anyway even Milky Tracker does not support this).
The zip also contains version 9 just in case there was a mistake in the Protracker handler update.
Some improvements to this Protracker handler are still possible but the gains would be very limited.
The mixer can gain CPU time by changing the number of frames it divides the VBL in but memory requirements and output quality would change.
So i guess in terms of peak CPU usage this is almost it.
Average CPU requirements, important for 3D or multi-VBL demos, can still improved but more memory will be required.
So here are the new benchmarks for the worsemod.mod case:
Volume control + no trash:
47.86% @ 50 KHz stereo
40.52% @ 25 KHz stereo
28.91% @ 12.5 KHz stereo
46.52% @ 50 KHz stereo
39.17% @ 25 KHz stereo
27.58% @ 12.5 KHz stereo
41.56% @ 50 KHz stereo
34.23% @ 25 KHz stereo
22.60% @ 12.5 KHz stereo
Volume control + 8 trash buffers:
42.84% @ 50 KHz stereo
35.49% @ 25 KHz stereo
23.75% @ 12.5 KHz stereo
41.67% @ 50 KHz stereo
34.33% @ 25 KHz stereo
22.60% @ 12.5 KHz stereo
40.03% @ 50 KHz stereo
32.71% @ 25 KHz stereo
21.06% @ 12.5 KHz stereo
The above benchmarks and all published before correspond to the left CPU time.
When i say that 40% are used, in fact it was measured that there was 60% CPU time left.
Those 40% include the time taken to measure and the TOS MFP interrupts.
If you remove the TOS interrupts by uncommenting 3 intructions in instmfp
subrout, you will gain more than 1.5% CPU time:
Volume control + 8 trash buffers + no TOS MFP interrupts:
38.49% @ 50 KHz stereo
31.14% @ 25 KHz stereo
19.52% @ 12.5 KHz stereo