apple / swift-nio

Event-driven network application framework for high performance protocol servers & clients, non-blocking.
https://swiftpackageindex.com/apple/swift-nio/documentation
Apache License 2.0
7.85k stars 633 forks source link

Remove storage indirection for FileSystemError #2726

Closed glbrntt closed 1 month ago

glbrntt commented 1 month ago

Motivation:

Existentials are boxed if they are wider than 24 bytes. A number of value types in NIO are implemented with storage classes so that the alloaction is only paid for once. However, existential errors are treated differently, they are unconditionally boxed. Implementing errors with storage classes therefore introduces an unnecessary allocation.

Modifications:

Result:

Fewer allocations