forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite7c2b95
committed
Optimize a few list_delete_ptr calls
There is a handful of places where we called list_delete_ptr() to removesome element from a List. In many of these places we know, or with verylittle additional effort know the index of the ListCell that we need toremove.Here we change all of those places to instead either use one of;list_delete_nth_cell(), foreach_delete_current() or list_delete_last().Each of these saves from having to iterate over the list to search for theelement to remove by its pointer value.There are some small performance gains to be had by doing this, but in thegeneral case, none of these lists are likely to be very large, so thelookup was probably never that expensive anyway. However, some of thecalls are in fairly hot code paths, e.g process_equivalence(). So anysmall gains there are useful.Author: Zhijie Hou and David RowleyDiscussion:https://postgr.es/m/b3517353ec7c4f87aa560678fbb1034b@G08CNEXMBPEKD05.g08.fujitsu.local1 parent85c5428 commite7c2b95
File tree
5 files changed
+16
-12
lines changed- src/backend
- optimizer/path
- parser
- rewrite
5 files changed
+16
-12
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
| 140 | + | |
140 | 141 |
| |
141 | 142 |
| |
142 | 143 |
| |
| |||
258 | 259 |
| |
259 | 260 |
| |
260 | 261 |
| |
| 262 | + | |
261 | 263 |
| |
262 | 264 |
| |
263 | 265 |
| |
| |||
311 | 313 |
| |
312 | 314 |
| |
313 | 315 |
| |
| 316 | + | |
314 | 317 |
| |
315 | 318 |
| |
316 | 319 |
| |
| |||
371 | 374 |
| |
372 | 375 |
| |
373 | 376 |
| |
374 |
| - | |
| 377 | + | |
375 | 378 |
| |
376 | 379 |
| |
377 | 380 |
| |
| |||
1964 | 1967 |
| |
1965 | 1968 |
| |
1966 | 1969 |
| |
| 1970 | + | |
1967 | 1971 |
| |
1968 | 1972 |
| |
1969 | 1973 |
| |
| |||
2008 | 2012 |
| |
2009 | 2013 |
| |
2010 | 2014 |
| |
| 2015 | + | |
2011 | 2016 |
| |
2012 | 2017 |
| |
2013 | 2018 |
| |
| |||
2072 | 2077 |
| |
2073 | 2078 |
| |
2074 | 2079 |
| |
2075 |
| - | |
| 2080 | + | |
2076 | 2081 |
| |
2077 | 2082 |
| |
2078 | 2083 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1005 | 1005 |
| |
1006 | 1006 |
| |
1007 | 1007 |
| |
1008 |
| - | |
1009 |
| - | |
| 1008 | + | |
| 1009 | + | |
1010 | 1010 |
| |
1011 | 1011 |
| |
1012 | 1012 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1698 | 1698 |
| |
1699 | 1699 |
| |
1700 | 1700 |
| |
1701 |
| - | |
| 1701 | + | |
| 1702 | + | |
1702 | 1703 |
| |
1703 | 1704 |
| |
1704 | 1705 |
| |
1705 |
| - | |
| 1706 | + | |
1706 | 1707 |
| |
1707 | 1708 |
| |
1708 | 1709 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
360 | 360 |
| |
361 | 361 |
| |
362 | 362 |
| |
| 363 | + | |
363 | 364 |
| |
364 | 365 |
| |
365 | 366 |
| |
| |||
386 | 387 |
| |
387 | 388 |
| |
388 | 389 |
| |
| 390 | + | |
389 | 391 |
| |
390 | 392 |
| |
391 | 393 |
| |
| |||
405 | 407 |
| |
406 | 408 |
| |
407 | 409 |
| |
408 |
| - | |
| 410 | + | |
409 | 411 |
| |
410 | 412 |
| |
411 | 413 |
| |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
650 | 650 |
| |
651 | 651 |
| |
652 | 652 |
| |
653 |
| - | |
654 |
| - | |
655 |
| - | |
656 |
| - | |
657 |
| - | |
| 653 | + | |
658 | 654 |
| |
659 | 655 |
| |
660 | 656 |
| |
|
0 commit comments
Comments
(0)