forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit913ec71
committed
Improve compiler code layout in elog/ereport ERROR calls
Here we use a bit of preprocessor trickery to coax supporting compilersinto laying out their generated code so that the code that's in the samebranch as elog(ERROR)/ereport(ERROR) calls is moved away from the hotpath. Effectively, this reduces the size of the hot code meaning that itcan sit on fewer cache lines.Performance improvements of between 10-15% have been seen on highly CPUbound workloads using pgbench's TPC-b benchmark.What's achieved here is very similar to putting the error condition insidean unlikely() macro. For example;if (unlikely(x < 0)) elog(ERROR, "invalid x value");now there's no need to make use of unlikely() here as the common macroused by elog and ereport will now see that elevel is >= ERROR and make useof a pg_attribute_cold marked version of errstart().When elevel < ERROR or if it cannot be determined to be constant, theoriginal behavior is maintained.Author: David RowleyReviewed-by: Andres Freund, Peter EisentrautDiscussion:https://postgr.es/m/CAApHDvrVpasrEzLL2er7p9iwZFZ%3DJj6WisePcFeunwfrV0js_A%40mail.gmail.com1 parent697e1d0 commit913ec71
2 files changed
+26
-1
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
222 | 235 |
| |
223 | 236 |
| |
224 | 237 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
114 | 123 |
| |
115 | 124 |
| |
116 | 125 |
| |
| |||
124 | 133 |
| |
125 | 134 |
| |
126 | 135 |
| |
127 |
| - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
128 | 139 |
| |
129 | 140 |
| |
130 | 141 |
| |
| |||
146 | 157 |
| |
147 | 158 |
| |
148 | 159 |
| |
| 160 | + | |
149 | 161 |
| |
150 | 162 |
| |
151 | 163 |
| |
|
0 commit comments
Comments
(0)