- Notifications
You must be signed in to change notification settings - Fork5
Commit4a14f13
committed
Improve hash_create's API for selecting simple-binary-key hash functions.
Previously, if you wanted anything besides C-string hash keys, you had tospecify a custom hashing function to hash_create(). Nearly all suchcallers were specifying tag_hash or oid_hash; which is tedious, and rathererror-prone, since a caller could easily miss the opportunity to optimizeby using hash_uint32 when appropriate. Replace this with a design wherebycallers using simple binary-data keys just specify HASH_BLOBS and don'tneed to mess with specific support functions. hash_create() itself willtake care of optimizing when the key size is four bytes.This nets out saving a few hundred bytes of code space, and offersa measurable performance improvement in tidbitmap.c (which was notexploiting the opportunity to use hash_uint32 for its 4-byte keys).There might be some wins elsewhere too, I didn't analyze closely.In future we could look into offering a similar optimized hashing functionfor 8-byte keys. Under this design that could be done in a centralizedand machine-independent fashion, whereas getting it right for keys ofplatform-dependent sizes would've been notationally painful before.For the moment, the old way still works fine, so as not to break sourcecode compatibility for loadable modules. Eventually we might want toremove tag_hash and friends from the exported API altogether, since there'sno real need for them to be explicitly referenced from outside dynahash.c.Teodor Sigaev and Tom Lane1 parentba94518 commit4a14f13
File tree
42 files changed
+127
-155
lines changed- contrib
- pg_trgm
- postgres_fdw
- src
- backend
- access
- gist
- heap
- transam
- commands
- nodes
- optimizer/util
- parser
- postmaster
- replication/logical
- storage
- buffer
- lmgr
- smgr
- utils
- adt
- cache
- fmgr
- hash
- time
- include/utils
- pl
- plperl
- plpgsql/src
- plpython
- tcl
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+127
-155
lines changedLines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
915 | 915 |
| |
916 | 916 |
| |
917 | 917 |
| |
918 |
| - | |
919 | 918 |
| |
920 | 919 |
| |
921 | 920 |
| |
922 |
| - | |
| 921 | + | |
923 | 922 |
| |
924 | 923 |
| |
925 | 924 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
113 | 112 |
| |
114 | 113 |
| |
115 | 114 |
| |
116 | 115 |
| |
117 |
| - | |
| 116 | + | |
118 | 117 |
| |
119 | 118 |
| |
120 | 119 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1142 | 1142 |
| |
1143 | 1143 |
| |
1144 | 1144 |
| |
1145 |
| - | |
1146 | 1145 |
| |
1147 | 1146 |
| |
1148 | 1147 |
| |
1149 |
| - | |
1150 |
| - | |
| 1148 | + | |
1151 | 1149 |
| |
1152 | 1150 |
| |
1153 | 1151 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
| 79 | + | |
79 | 80 |
| |
80 | 81 |
| |
81 | 82 |
| |
82 |
| - | |
83 |
| - | |
84 | 83 |
| |
85 | 84 |
| |
86 | 85 |
| |
87 |
| - | |
88 |
| - | |
| 86 | + | |
89 | 87 |
| |
90 | 88 |
| |
91 | 89 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
283 | 283 |
| |
284 | 284 |
| |
285 | 285 |
| |
286 |
| - | |
287 | 286 |
| |
288 | 287 |
| |
289 | 288 |
| |
290 | 289 |
| |
291 | 290 |
| |
292 |
| - | |
| 291 | + | |
293 | 292 |
| |
294 | 293 |
| |
295 | 294 |
| |
296 | 295 |
| |
297 | 296 |
| |
298 | 297 |
| |
299 | 298 |
| |
300 |
| - | |
| 299 | + | |
301 | 300 |
| |
302 | 301 |
| |
303 | 302 |
| |
| |||
834 | 833 |
| |
835 | 834 |
| |
836 | 835 |
| |
837 |
| - | |
838 | 836 |
| |
839 | 837 |
| |
840 | 838 |
| |
841 | 839 |
| |
842 | 840 |
| |
843 |
| - | |
| 841 | + | |
844 | 842 |
| |
845 | 843 |
| |
846 | 844 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 |
| - | |
111 | 110 |
| |
112 | 111 |
| |
113 | 112 |
| |
114 | 113 |
| |
115 |
| - | |
| 114 | + | |
116 | 115 |
| |
117 | 116 |
| |
118 | 117 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
986 | 986 |
| |
987 | 987 |
| |
988 | 988 |
| |
989 |
| - | |
990 | 989 |
| |
991 | 990 |
| |
992 |
| - | |
| 991 | + | |
993 | 992 |
| |
994 | 993 |
| |
995 | 994 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
224 |
| - | |
225 | 224 |
| |
226 | 225 |
| |
227 | 226 |
| |
228 | 227 |
| |
229 |
| - | |
| 228 | + | |
230 | 229 |
| |
231 | 230 |
| |
232 | 231 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1711 | 1711 |
| |
1712 | 1712 |
| |
1713 | 1713 |
| |
1714 |
| - | |
1715 | 1714 |
| |
1716 |
| - | |
| 1715 | + | |
1717 | 1716 |
| |
1718 | 1717 |
| |
1719 | 1718 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1059 | 1059 |
| |
1060 | 1060 |
| |
1061 | 1061 |
| |
1062 |
| - | |
1063 | 1062 |
| |
1064 |
| - | |
| 1063 | + | |
1065 | 1064 |
| |
1066 | 1065 |
| |
1067 | 1066 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
922 | 922 |
| |
923 | 923 |
| |
924 | 924 |
| |
925 |
| - | |
926 | 925 |
| |
927 | 926 |
| |
928 |
| - | |
| 927 | + | |
929 | 928 |
| |
930 | 929 |
| |
931 | 930 |
| |
| |||
1997 | 1996 |
| |
1998 | 1997 |
| |
1999 | 1998 |
| |
2000 |
| - | |
2001 | 1999 |
| |
2002 | 2000 |
| |
2003 | 2001 |
| |
2004 | 2002 |
| |
2005 |
| - | |
| 2003 | + | |
2006 | 2004 |
| |
2007 | 2005 |
| |
2008 | 2006 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1212 | 1212 |
| |
1213 | 1213 |
| |
1214 | 1214 |
| |
1215 |
| - | |
1216 | 1215 |
| |
1217 | 1216 |
| |
1218 | 1217 |
| |
1219 | 1218 |
| |
1220 | 1219 |
| |
1221 |
| - | |
| 1220 | + | |
1222 | 1221 |
| |
1223 | 1222 |
| |
1224 | 1223 |
| |
|
Lines changed: 7 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1132 | 1132 |
| |
1133 | 1133 |
| |
1134 | 1134 |
| |
1135 |
| - | |
1136 | 1135 |
| |
1137 | 1136 |
| |
1138 | 1137 |
| |
1139 | 1138 |
| |
1140 |
| - | |
| 1139 | + | |
1141 | 1140 |
| |
1142 | 1141 |
| |
1143 | 1142 |
| |
| |||
1520 | 1519 |
| |
1521 | 1520 |
| |
1522 | 1521 |
| |
1523 |
| - | |
1524 | 1522 |
| |
1525 | 1523 |
| |
1526 | 1524 |
| |
1527 |
| - | |
| 1525 | + | |
1528 | 1526 |
| |
1529 | 1527 |
| |
1530 | 1528 |
| |
| |||
3483 | 3481 |
| |
3484 | 3482 |
| |
3485 | 3483 |
| |
3486 |
| - | |
3487 | 3484 |
| |
3488 | 3485 |
| |
3489 | 3486 |
| |
3490 |
| - | |
| 3487 | + | |
3491 | 3488 |
| |
3492 | 3489 |
| |
3493 | 3490 |
| |
3494 |
| - | |
3495 | 3491 |
| |
3496 | 3492 |
| |
3497 | 3493 |
| |
3498 |
| - | |
| 3494 | + | |
3499 | 3495 |
| |
3500 | 3496 |
| |
3501 | 3497 |
| |
| |||
3902 | 3898 |
| |
3903 | 3899 |
| |
3904 | 3900 |
| |
3905 |
| - | |
3906 | 3901 |
| |
3907 | 3902 |
| |
3908 |
| - | |
| 3903 | + | |
3909 | 3904 |
| |
3910 | 3905 |
| |
3911 | 3906 |
| |
| |||
4026 | 4021 |
| |
4027 | 4022 |
| |
4028 | 4023 |
| |
4029 |
| - | |
4030 | 4024 |
| |
4031 | 4025 |
| |
4032 | 4026 |
| |
4033 | 4027 |
| |
4034 |
| - | |
| 4028 | + | |
4035 | 4029 |
| |
4036 | 4030 |
| |
4037 | 4031 |
| |
4038 |
| - | |
4039 | 4032 |
| |
4040 | 4033 |
| |
4041 | 4034 |
| |
4042 | 4035 |
| |
4043 |
| - | |
| 4036 | + | |
4044 | 4037 |
| |
4045 | 4038 |
| |
4046 | 4039 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
245 | 245 |
| |
246 | 246 |
| |
247 | 247 |
| |
248 |
| - | |
249 | 248 |
| |
250 | 249 |
| |
251 | 250 |
| |
252 |
| - | |
| 251 | + | |
253 | 252 |
| |
254 | 253 |
| |
255 | 254 |
| |
| |||
1111 | 1110 |
| |
1112 | 1111 |
| |
1113 | 1112 |
| |
1114 |
| - | |
1115 | 1113 |
| |
1116 | 1114 |
| |
1117 | 1115 |
| |
| |||
1120 | 1118 |
| |
1121 | 1119 |
| |
1122 | 1120 |
| |
1123 |
| - | |
| 1121 | + | |
1124 | 1122 |
| |
1125 | 1123 |
| |
1126 | 1124 |
| |
| |||
2434 | 2432 |
| |
2435 | 2433 |
| |
2436 | 2434 |
| |
2437 |
| - | |
2438 | 2435 |
| |
2439 | 2436 |
| |
2440 |
| - | |
| 2437 | + | |
2441 | 2438 |
| |
2442 | 2439 |
| |
2443 | 2440 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 |
| - | |
63 | 62 |
| |
64 | 63 |
| |
65 | 64 |
| |
66 | 65 |
| |
67 | 66 |
| |
68 |
| - | |
| 67 | + | |
69 | 68 |
| |
70 | 69 |
| |
71 | 70 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2063 | 2063 |
| |
2064 | 2064 |
| |
2065 | 2065 |
| |
2066 |
| - | |
2067 | 2066 |
| |
2068 | 2067 |
| |
2069 |
| - | |
| 2068 | + | |
2070 | 2069 |
| |
2071 | 2070 |
| |
2072 | 2071 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
415 | 415 |
| |
416 | 416 |
| |
417 | 417 |
| |
418 |
| - | |
419 | 418 |
| |
420 | 419 |
| |
421 | 420 |
| |
422 | 421 |
| |
423 |
| - | |
| 422 | + | |
424 | 423 |
| |
425 | 424 |
| |
426 | 425 |
| |
|
0 commit comments
Comments
(0)