pgsql: Optimise numeric division for one and two base-NBASE digit divis
От | Dean Rasheed |
---|---|
Тема | pgsql: Optimise numeric division for one and two base-NBASE digit divis |
Дата | |
Msg-id | E1nOHVM-0008KS-8C@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Optimise numeric division for one and two base-NBASE digit divisors. Formerly div_var() had "fast path" short division code that was significantly faster when the divisor was just one base-NBASE digit, but otherwise used long division. This commit adds a new function div_var_int() that divides by an arbitrary 32-bit integer, using the fast short division algorithm, and updates both div_var() and div_var_fast() to use it for one and two digit divisors. In the case of div_var(), this is slightly faster in the one-digit case, because it avoids some digit array copying, and is much faster in the two-digit case where it replaces long division. For div_var_fast(), it is much faster in both cases because the main div_var_fast() algorithm is optimised for larger inputs. Additionally, optimise exp() and ln() by using div_var_int(), allowing a NumericVar to be replaced by an int in a couple of places, most notably in the Taylor series code. This produces a significant speedup of exp(), ln() and the numeric_big regression test. Dean Rasheed, reviewed by Tom Lane. Discussion: https://postgr.es/m/CAEZATCVwsBi-ND-t82Cuuh1=8ee6jdOpzsmGN+CUZB6yjLg9jw@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d1b307eef2818fe24760cc2c168d7d65d59775a8 Modified Files -------------- src/backend/utils/adt/numeric.c | 223 ++++++++++++++++++++++++++++++++-------- 1 file changed, 180 insertions(+), 43 deletions(-)
В списке pgsql-committers по дате отправления: