dsharlet / LiveSPICE

Real time SPICE simulation for audio signals
MIT License
419 stars 61 forks source link

Update SDK to net6.0-windows (fixes #176) #179

Closed dsharlet closed 1 year ago

dsharlet commented 1 year ago

Fixes #176

dsharlet commented 1 year ago

I've done some spot checking of tests with this branch and things look good. I'm going to merge this soon and then do more testing with a release run from the GH action workflow.

dsharlet commented 1 year ago

And more good news: it looks like this change is anywhere from a 25% to >2x performance improvement over master! The "big" interesting circuits look about 50% faster.

dsharlet commented 1 year ago

I think I tried net7.0 and ran into some issue with VS. I thought I'd get this done for now to unblock the release, and then figure out upgrading my visual studio separately.

Federerer commented 1 year ago

And more good news: it looks like this change is anywhere from a 25% to >2x performance improvement over master! The "big" interesting circuits look about 50% faster.

I did some testing and in my case it's closer to 5%, most probably because I use my schematics that are "presorted" by genetic algorithm ;) Old version of ComputerAlgebra:

PS C:\Users\<redacted>\Documents\dev\livespice-circuits\Fender> LiveSPICE.exe benchmark '.\Fender Tweed Deluxe 5e3.schx' --oversample 1 --legacy
Opening .\Fender Tweed Deluxe 5e3.schx
Schematic loaded from '.\Fender Tweed Deluxe 5e3.schx'
Building circuit...
Build: 0 errors, 0 warnings
Legacy simulation process
Analyze time: 00:00:00.0717570
Solve time: 00:00:01.2996437
Build time: 00:00:00.1214741
126 kHz, 2,63x real time

New version:

PS C:\Users\<redacted>\Documents\dev\livespice-circuits\Fender> LiveSPICE.exe benchmark '.\Fender Tweed Deluxe 5e3.schx' --oversample 1 --legacy -v info
Opening .\Fender Tweed Deluxe 5e3.schx
Schematic loaded from '.\Fender Tweed Deluxe 5e3.schx'
Building circuit...
Build: 0 errors, 0 warnings
Legacy simulation process
Analyze time: 00:00:00.0706084
Building solution for h=2,0833333333333333E-05
Performing steady state analysis...
Failed to find partition initial conditions, simulation may be unstable.
Performing transient analysis...
System solved, 2 solution sets for 66 unknowns.
Solve time: 00:00:01.4523400
Build time: 00:00:00.1257933
127 kHz, 2,65x real time

I've also done some further optimizations to the compilation process (Removing not used temporary variables, and also not calculating KnownDeltas that aren't required by outputs and Newton iterations) This gives additional 0-40% gain depending on circuit and how many probes do you use. This is most useful in plugin though, as we only need one output.

PS C:\Users\<redacted>\Documents\dev\livespice-circuits\Fender> LiveSPICE.exe benchmark '.\Fender Tweed Deluxe 5e3.schx' --oversample 1 -v info
Opening .\Fender Tweed Deluxe 5e3.schx
Schematic loaded from '.\Fender Tweed Deluxe 5e3.schx'
Building circuit...
Build: 0 errors, 0 warnings
Analyze time: 00:00:00.0745907
Building solution for h=2,0833333333333333E-05
Performing steady state analysis...
Failed to find partition initial conditions, simulation may be unstable.
Performing transient analysis...
System solved, 2 solution sets for 66 unknowns.
Solve time: 00:00:01.5364924
Newton iteration size: 15
ToReplace: 1112, replaced: 1111
Build time: 00:00:00.3749314
153 kHz, 3,2x real time