vapor / postgres-nio

🐘 Non-blocking, event-driven Swift client for PostgreSQL.
https://api.vapor.codes/postgresnio/documentation/postgresnio/
MIT License
322 stars 75 forks source link

Remove generic usage from `avoidingStateMachineCoW()` so it doesn't need to be force-inlined #394

Closed gwynne closed 1 year ago

gwynne commented 1 year ago

The comment explaining avoidingStateMachineCoW() states:

/// Sadly, because it's generic and has a closure, we need to force it to be inlined
/// at all call sites, which is not ideal.

However, at all but one call site, it always returns the same type, so it doesn't really need to be generic and we can avoid the "not ideal" inlining requirement.

codecov-commenter commented 1 year ago

Codecov Report

Merging #394 (53decb0) into main (5217ba7) will increase coverage by 0.03%. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #394 +/- ## ========================================== + Coverage 47.53% 47.57% +0.03% ========================================== Files 109 109 Lines 8764 8770 +6 ========================================== + Hits 4166 4172 +6 Misses 4598 4598 ``` | [Files Changed](https://app.codecov.io/gh/vapor/postgres-nio/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor) | Coverage Δ | | |---|---|---| | [...nection State Machine/ConnectionStateMachine.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvQ29ubmVjdGlvbiBTdGF0ZSBNYWNoaW5lL0Nvbm5lY3Rpb25TdGF0ZU1hY2hpbmUuc3dpZnQ=) | `58.59% <100.00%> (ø)` | | | [...tion State Machine/ExtendedQueryStateMachine.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/394?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvQ29ubmVjdGlvbiBTdGF0ZSBNYWNoaW5lL0V4dGVuZGVkUXVlcnlTdGF0ZU1hY2hpbmUuc3dpZnQ=) | `78.14% <100.00%> (+0.33%)` | :arrow_up: |