This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Commit fc7cd1b
Queue<T> optimization of (Try)Dequeue (#26087)
* Queue RCE
With value types the effect is not so big, because there is still one (manual) check for bounds.
For reference types one bounds-check can be saved, so there is a win.
In MoveNext the conditional is with if, so the JIT can produce better code.
* MoveNext uses temp-Variable for register access instead of memory access
* Addressed PR feedback
* #26087 (review)
* #26087 (review)1 parent 7320c34 commit fc7cd1b
File tree
1 file changed
+19
-8
lines changed- src/System.Collections/src/System/Collections/Generic
1 file changed
+19
-8
lines changedLines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
241 | 244 | | |
242 | | - | |
| 245 | + | |
243 | 246 | | |
244 | 247 | | |
245 | | - | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| |||
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
255 | 261 | | |
256 | 262 | | |
257 | | - | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
261 | | - | |
| 267 | + | |
262 | 268 | | |
263 | 269 | | |
264 | | - | |
| 270 | + | |
265 | 271 | | |
266 | 272 | | |
267 | 273 | | |
| |||
367 | 373 | | |
368 | 374 | | |
369 | 375 | | |
370 | | - | |
371 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
372 | 379 | | |
373 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
374 | 385 | | |
375 | 386 | | |
376 | 387 | | |
| |||
0 commit comments