| ▲ | snuxoll 3 days ago | |||||||
As somebody who's been, for whatever reason, toying around with writing a COM-style ABI layer in Rust, there's a lot of good ideas in there and I think a lot of the hatred comes from the DLL hell that was spawned by registration; along with the, unfortunately necessary, boilerplate. Virtual dispatch absolutely has an overhead, but absolutely nobody in their right mind should be using COM interfaces in a critical section of code. When we're talking things like UI elements, HTTP clients, whatever, the overhead of an indirect call is negligible compared to the time spent inside a function. The one thing I'm personally trying to see if there's any room for improvement on in a clean slate design, is error handling / HRESULT values. Exceptions get abused for flow control and stack unwinding is expensive, so even if there was a sane way to implement cross-language exception handling it's a non starter. But HRESULT leads to IErrorInfo, ISupportErrorInfo, thread local state SetErrorInfo/GetErrorInfo, which is a whole extra bunch of fun to deal with. There's the option of going the GObject and AppKit route, using an out parameter for an Error type - but you have to worry about freeing/releasing this in your language bindings or risk leaking memory. | ||||||||
| ▲ | pjmlp a day ago | parent | next [-] | |||||||
Registration free COM has existed since Windows XP, if I get my timeline right without bothering to look it up. All modern Windows APIs introduced since Vista have been COM, classical Win32 C APIs are seldom introduced nowadays. Certainly current Windows 11 performance problems have nothing to do with using COM all over the place, rather Webwidgets instead of native code, hiring people that apparently never did Windows programming, that apparently do AI driven coding. Ah, macOS and iDevices driver model is equally based in COM like design, one would expect drivers to be something where performance matters. Then there is XPC, Android IPC, and one could consider D-BUS as well, if it was more widely adopted across the GNU/Linux world. | ||||||||
| ||||||||
| ▲ | dleary 3 days ago | parent | prev | next [-] | |||||||
> Virtual dispatch absolutely has an overhead, but absolutely nobody in their right mind should be using COM interfaces in a critical section of code. I could definitely be wrong, but I think C++ style "virtual dispatch" (ie, following two pointers instead of one to get to your function) doesn't really cost anything anymore, except for the extra pointers taking up cache space. Don't all of the Windows DirectX gaming interfaces use COM? And isn't AAA gaming performance critical? | ||||||||
| ||||||||
| ▲ | WorldMaker 3 days ago | parent | prev [-] | |||||||
WinRT is certainly not a "clean slate design", but still a useful comparison to see where Microsoft themselves iterated on the COM design with decades of hindsight. | ||||||||
| ||||||||