GNU bug report logs - #42269
Remove non-GMP code from coreutils factor.c

Previous Next

Package: coreutils;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Wed, 8 Jul 2020 16:27:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 42269 <at> debbugs.gnu.org
Cc: James Youngman <jay <at> gnu.org>, Pádraig Brady <P <at> draigBrady.com>, Torbjörn Granlund <tg <at> gmplib.org>, Jim Meyering <jim <at> meyering.net>
Subject: bug#42269: Remove non-GMP code from coreutils factor.c
Date: Wed, 8 Jul 2020 09:25:57 -0700
[Message part 1 (text/plain, inline)]
I recently modified GNU coreutils so that it can assume GMP, possibly by 
compiling and linking mini-gmp.c. This helps simplify the coreutils source code 
and makes coreutils behavior more portable.

In doing so, I noticed that factor.c has special-purpose code to factor integers 
up to 127 bits. Although this code added functionality when coreutils could not 
assume GMP, it's no longer needed for that. And although it runs faster than the 
GMP code does, while doing the recent surgery on factor.c I began to wonder 
whether the hassle of maintaining the code outweighed its usefulness. So I wrote 
up the attached patch, which simply removes the non-GMP code and simplifies 
factor.c quite a bit.

I assume the attached patch will hurt performance significantly in some cases 
for 127-bit numbers, so I did not install it. Perhaps it would be better to keep 
the non-GMP algorithm and recode it with GMP. Or perhaps it would be better to 
leave the factor.c code alone.

Comments?
[0001-factor-simplify-by-assuming-libgmp.patch (text/x-patch, attachment)]

This bug report was last modified 5 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.