Dean Rasheed <dean.a.rash...@gmail.com> writes: > Attached are 3 small patches that improve the performance of numeric > division. Patch 0002 seems to have the biggest impact, but I think > they're all worth including, since they're quite simple changes, with > noticeable performance gains.
I took a quick look through these (just eyeball, didn't try to verify your performance statements). I'm +1 on 0001 and 0002, but 0003 feels a bit ad-hoc. It certainly *looks* weird for the allegedly faster function to be handing off to the allegedly slower one. I also wonder if we're leaving anything on the table by not exploiting div_var_fast's weaker roundoff guarantees in this case. Should we think about a more thoroughgoing redesign of these functions' APIs? Another idea is to only worry about the single-divisor-digit optimization, and just copy div_var's (very small) inner loop for that case into div_var_fast. regards, tom lane