diff options
author | Denys Vlasenko | 2020-12-22 20:08:40 +0100 |
---|---|---|
committer | Denys Vlasenko | 2020-12-22 20:24:30 +0100 |
commit | 6452c300366cf0e322227ad39991ec2fdfd6beed (patch) | |
tree | d2086c915ebeddea5775aa66e0dc07dae41addc2 /coreutils/shuf.c | |
parent | 96717d9fb4560ad98a737108f83c7b247ef04674 (diff) | |
download | busybox-6452c300366cf0e322227ad39991ec2fdfd6beed.zip busybox-6452c300366cf0e322227ad39991ec2fdfd6beed.tar.gz |
factor: detect squares
If we have a square, the speedup can be extremely large
(in best case example below, it's ~40000 times faster):
$ time ./busybox_old factor 18446743988964486098
18446743988964486098: 2 3037000493 3037000493
real 0m4.246s
$ time ./busybox factor 18446743988964486098
18446743988964486098: 2 3037000493 3037000493
real 0m0.000s
function old new delta
isqrt_odd - 57 +57
print_w - 36 +36
factorize 218 236 +18
print_h - 7 +7
factorize_numstr 65 72 +7
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/0 up/down: 125/0) Total: 125 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/shuf.c')
0 files changed, 0 insertions, 0 deletions