Zero-cost 'Service Provider Interface'/Signature Packages

@Erik_Eckstein, I actually missed this reply almost a year ago. Just to be 100% sure, I'm right in thinking that there's no way to get speculative devirt work across modules today?

I'm asking logging discussion just started in the Server Work Group and actually designing a logging system in Swift is quite a bad place to be in:

  • people want to swap concrete logger implementations -> need an existential Logger
  • @autoclosure would be good for logging -> does allocations (unless we can get it inlined but we can't because it crosses modules so speculative devirt won't work (AFAIK))
  • to read the logger configuration (like minimum log level) you need a lock (because no memory model/atomics right now) unless you have one designated logger thread/process
  • you could firehose all logs from all threads into one designated process/thread but that'll either need a lock (to append to a shared logging queue) or a syscall (to write to a pipe/send UDP packet) because there's currently no performant way to build a MPSC (multiple producer single consumer) queue as we're lacking the atomics

Even reaching out to C to implement everything in a logging system isn't easy because to get from Swift's String a const char * we need to allocate too...

Maybe I should fork off a separate thread to discuss the performance issues that we'll see when implementing a logging library.