Re: Optimize numeric.c mul_var() using the Karatsuba algorithm - Mailing list pgsql-hackers

From Aaron Altman
Subject Re: Optimize numeric.c mul_var() using the Karatsuba algorithm
Date
Msg-id 171832724172.156537.15821392522000571944.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: Optimize numeric.c mul_var() using the Karatsuba algorithm  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: Optimize numeric.c mul_var() using the Karatsuba algorithm
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  not tested
Implements feature:       not tested
Spec compliant:           not tested
Documentation:            not tested

This applies cleanly to master, builds and passes regression tests in my Windows/Cygwin environment.  

I also read through comments and confirmed for myself that the assumption about the caller ensuring var1 is shorter is
donealready in unchanged code from mul_var.  Frees correspond to inits.  The "Karatsuba condition" reasoning for
decidingwhether a number is big enough to use this algorithm appears to match what Joel has stated in this thread.
 

The arithmetic appears to match what's been described in the comments.  I have *not* confirmed that with any detailed
reviewof the Karatsuba algorithm from outside sources, other implementations like the Rust one referenced here, or
anythingsimilar.  I'm hoping that the regression tests give sufficient coverage that if the arithmetic was incorrect
therewould be obvious failures.  If additional coverage was needed, cases falling immediately on either side of the
limitingconditions used in the patch would probably be useful.  From the limited precedent I've exposed myself to, that
doesn'tseem to be required here, but I'm open to contrary input from other reviewers.  In the meantime, I'm marking
thisapproved.  
 

Thanks for the detailed background and comments, Joel!

The new status of this patch is: Ready for Committer

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: race condition in pg_class
Next
From: Chapman Flack
Date:
Subject: Re: jsonpath: Missing Binary Execution Path?