Commit 98b0309
Use IO#read instead of manual readfull loop
Replace the manual `readfull` loop with Ruby's built-in `IO#read` method.
Modern Ruby (3.1+) handles non-blocking reads internally with proper
timeout support via `IO#timeout=`, making the manual loop unnecessary.
This provides ~7% performance improvement on read operations based on
benchmarks from PR #1026.
The `readfull` method is preserved in socket.rb for backwards compatibility
but is no longer used internally.
Based on work by @grcooper in PR #1026.
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent b6532d0 commit 98b0309
File tree
3 files changed
+4
-3
lines changed- lib/dalli/protocol
- test/integration
3 files changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
| 201 | + | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
0 commit comments