From: Charles Nutter Date: 2013-04-17T11:31:21+09:00 Subject: [ruby-core:54376] Re: [ruby-trunk - Bug #8208] Raise cached exceptions for nonblocking IO to avoid allocation/stack-copying costs On Apr 16, 2013, at 8:42 PM, Eric Wong wrote: > How does this compare to an implementation which returns symbols > like :wait_*able instead of raising exceptions? It will be more expensive, but mostly because exception-handling has a fair amount of overhead even with a cached exception object. I suggest this mostly because it may be considered less invasive than adding new APIs. >> The benefit of this change would be that nonblocking IO has zero >> wasted overhead. The down side would be that the exceptions raised do >> not have a useful backtrace unless debug or verbose. > > Exceptions for nonblocking I/O still makes --debug too noisy. Indeed! > I still think it's better to push for an exception-less API for common > errors. EAGAIN/EINPROGRESS/EWOULDBLOCK are far too common (and not > reasonably avoidable) to be considered exceptions. Agreed�but that hasn't happened yet. I'm hedging my bets :-) Which issue is tracking an exceptionless nonblocking API? Maybe we can nudge it forward. - Charlie