-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor use of strings in the engine. 10-20% callback speed improvem…
…ent. * Add ChannelHandle, a wrapper class for an integer handle that starts at 0 and increments. * Add ChannelHandleFactory for assigning integer handles to group strings. * Add ChannelHandleMap, an associative container mapping ChannelHandle to a template data type T. Backed by a QVarLengthArray with a pre-allocation of 256. Supports fast O(1) lookups (simple memory indexing) and amortized O(1) inserts. * Re-factor engine and effects code to use ChannelHandle. * Update EffectProcessor to use ChannelHandleMap instead of QHash. * Update EngineEffectChain to use ChannelHandleMap instead of QLinkedList. I did two tests -- one with effects inactive and one with effects active. I measured total-callback processing time improvements of 20% (1 track, no effects) and 13% (2 tracks, effects enabled). From this I conclude that the QHash and QLinkedList introduced tons of wasted cycles (which agrees with my profiling results from a month or two ago). Test 1: * No effects active * optimize=portable * single track playing for 1 minute * began sampling 20 seconds in to get rid of the load-track jitters Base: Debug [Main]: Stat("SoundDevicePortAudio::callbackProcess prepare 1, Built-in Output","count=45014,sum=3.82151e+09ns,average=84896ns,min=26393ns,max=429257ns,variance=9.41766e+08ns^2,stddev=30688.2ns") Experiment: Debug [Main]: Stat("SoundDevicePortAudio::callbackProcess prepare 1, Built-in Output","count=44856,sum=3.02069e+09ns,average=67342ns,min=20400ns,max=323169ns,variance=5.93287e+08ns^2,stddev=24357.5ns") Results: Minimum: reduced by 22.7% Maximum: reduced by 24.7% Average: reduced by 20.7% StdDev: reduced by 20.6% Test 2: * One effect active on [Master]. * One effect active on [Channel1] * optimize=portable * two tracks playing for 1 minute * began sampling 20 seconds in to get rid of the load-track jitters Base: Debug [Main]: Stat("SoundDevicePortAudio::callbackProcess prepare 1, Built-in Output","count=44937,sum=4.76277e+09ns,average=105988ns,min=38434ns,max=326061ns,variance=1.49815e+09ns^2,stddev=38706ns") Experiment: Debug [Main]: Stat("SoundDevicePortAudio::callbackProcess prepare 1, Built-in Output","count=45191,sum=4.15799e+09ns,average=92009.3ns,min=31693ns,max=333664ns,variance=1.11131e+09ns^2,stddev=33336.3ns") Results: Minimum: reduced by 17.5% Maximum: increase by 0.02% Average: reduced by 13.2% StdDev: reduced by 13.9%
- Loading branch information
Showing
62 changed files
with
697 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.