Re: Optimize mul_var() for var1ndigits >= 8
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Joel Jacobson <joel@compiler.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-29T21:59:57Z
Lists: pgsql-hackers
On Mon, 29 Jul 2024 at 21:39, Joel Jacobson <joel@compiler.org> wrote: > > I like these simplifications, how `var2ndigits` is used instead of `res_ndigits`: > - for (int i = res_ndigits - 3; i >= 1; i--) > + for (int i = var2ndigits - 1; i >= 1; i--) > > But I wonder why does `case 1:` not follow the same pattern? > for (int i = res_ndigits - 2; i >= 0; i--) > Ah yes, that should be made the same. (I think I did do that at one point, but then accidentally reverted it during a code refactoring.) > * v3-0002 > > I think it's non-obvious if the separate code paths for 32-bit and 64-bit, > using `#if SIZEOF_DATUM < 8`, to get *fast* 32-bit support, outweighs > the benefits of simpler code. > > You brought up the question if 32-bit systems should be regarded > as legacy previously in this thread. > > Unfortunately, we didn't get any feedback, so I'm starting a separate > thread, with subject "Is fast 32-bit code still important?", hoping to get > more input to help us make judgement calls. > Looking at that other thread that you found [1], I think it's entirely possible that there are people who care about 32-bit systems, which means that we might well get complaints, if we make it slower for them. Unfortunately, I don't have any way to test that (I doubt that running a 32-bit executable on my x86-64 system is a realistic test). Regards, Dean [1] https://postgr.es/m/0a71b43129fb447988f152941e1dbcb3@nidsa.net
Commits
-
Optimise numeric multiplication using base-NBASE^2 arithmetic.
- 8dc28d7eb868 18.0 landed
-
Extend mul_var_short() to 5 and 6-digit inputs.
- c4e44224cf61 18.0 landed