forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8870917
committed
Apply auto-vectorization to the inner loop of numeric multiplication.
Compile numeric.c with -ftree-vectorize where available, and adjustthe innermost loop of mul_var() so that it is amenable to beingauto-vectorized. (Mainly, that involves making it process the arraysleft-to-right not right-to-left.)Applying -ftree-vectorize actually makes numeric.o smaller, at leastwith my compiler (gcc 8.3.1 on x86_64), and it's a little faster too.Independently of that, fixing the inner loop to be vectorizable alsomakes things a bit faster. But doing both is a huge win formultiplications with lots of digits. For me, the numeric regressiontest is the same speed to within measurement noise, but numeric_bigis a full 45% faster.We also looked into applying -funroll-loops, but that makes numeric.obloat quite a bit, and the additional speed improvement is verymarginal.Amit Khandekar, reviewed and edited a little by meDiscussion:https://postgr.es/m/CAJ3gD9evtA_vBo+WMYMyT-u=keHX7-r8p2w7OSRfXf42LTwCZQ@mail.gmail.com1 parent695de5d commit8870917
2 files changed
+15
-3
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 |
| |
129 | 132 |
| |
130 | 133 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8191 | 8191 |
| |
8192 | 8192 |
| |
8193 | 8193 |
| |
| 8194 | + | |
8194 | 8195 |
| |
8195 | 8196 |
| |
8196 | 8197 |
| |
| |||
8327 | 8328 |
| |
8328 | 8329 |
| |
8329 | 8330 |
| |
| 8331 | + | |
| 8332 | + | |
| 8333 | + | |
| 8334 | + | |
| 8335 | + | |
| 8336 | + | |
| 8337 | + | |
8330 | 8338 |
| |
8331 |
| - | |
8332 |
| - | |
8333 |
| - | |
| 8339 | + | |
| 8340 | + | |
| 8341 | + | |
| 8342 | + | |
8334 | 8343 |
| |
8335 | 8344 |
| |
8336 | 8345 |
| |
|
0 commit comments
Comments
(0)