Re: The Synthizer Thread

@298
Basically exceptions get a bad reputation for 2 reasons: MSVC 32-bit punished you for simply having try blocks in your code (but *not* x64), whether or not exceptions were thrown, and throwing an exception is expensive because of stack unwinding.  But expensive is relative and in this context it's nothing as compared to the actual disk I/O, and the try/catch block overhead doesn't come up unless you're on 32-bit MSVC and entering lots of try blocks  (it's not a constant cost, it's a cost at every transition).  All the game devs went overboard on it and after the nth story of "huh, if I don't throw thousands of exceptions per frame, this works much faster" in the 2000s, well, there you go, obviously it's not the programmer.

You'll only find try blocks in a few places, possibly with a  few exceptions: at the uppermost stack frames of threads, hidden behind the SYZ_PROLOGUE/SYZ_EPILOGUE macros for the C API, and in a couple other places that want to just swallow all errors.  I think that the file stream stuff is the only place that uses them for something that's not hard failure.

I won't say it doesn't matter, but I will say that I watch debug builds running the rather expensive reverb algorithm and/or tens of sources run at like 2% or 3% CPU.  I mean yes, I'm on a tower.  But it's still really fast.  If you can find a tight loop somewhere that's like "I know, how about an exception on every iteration" this might be worth figuring out, otherwise shrug.  Technically you could make a bunch of C API calls that are specifically designed to use the overhead in Invokable for marshalling an exception between threads to cause the audio thread to basically just pin a core, but you'd have to try pretty hard for it.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector

Reply via email to