Commit graph

89 commits

Author SHA1 Message Date
Roy Ivy III
f82de13847 docs ~ spell-check repairs and addition of exceptions 2020-05-30 01:36:02 -05:00
Roy Ivy III
38ebc14b29 maint/build ~ remove .gitignore from sub-crate 'cut' 2020-05-29 22:59:48 -05:00
Roy Ivy III
21a4da905f fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
ea3235c7e2 change ~ new_coreopts!() => app!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
4b8fc7445b change ~ disp_err!() => show_usage_error!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
6f465eeb9f deps ~ update utils to uucore/uucore_procs v0.0.4 2020-05-29 22:59:48 -05:00
Roy Ivy III
e3fd15e73c fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
156031b929 fix/sync ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
fc9abdc179 fix/tail ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
64f888d364 fix/cp ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
251905da3d fix/du ~ update to correct WinAPI usage (fixes #1496) 2020-05-29 22:59:47 -05:00
Roy Ivy III
131bca3d53 fix/split ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
3129c8fbe5 fix/od ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
d4aa3a2231 fix 'edition="2018"' module import errors
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388> @@ <https://archive.is/iCaXp>
2020-05-29 22:59:47 -05:00
Roy Ivy III
d70db1f7d2 docs ~ improve/update sub-crate meta information 2020-05-29 22:59:47 -05:00
Roy Ivy III
45a1609a38 update held/pinned dependencies (to maintain MinSRV v1.31.0) 2020-05-29 22:59:47 -05:00
Roy Ivy III
7cfa8be5f2 docs ~ add meta information to sub-crates 2020-05-29 22:59:47 -05:00
Roy Ivy III
6cb609aeee docs/codespell ~ fix spelling errors 2020-05-29 22:59:47 -05:00
Roy Ivy III
db2e950918 change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00
Roy Ivy III
6606408ce9 refactor/polish ~ whitespace normalization (consistent indentation [either tabs *or* spaces], EOF EOLNs, no trailing whitespace) 2020-05-24 17:29:07 -05:00
Roy Ivy III
09abcf8cbe
Merge pull request #1525 from nbraud/factor/faster
Performance improvements for `factor`
2020-05-24 16:54:04 -05:00
Nicolas Braud-Santoni
4c3682aec7
factor::Factors::add: Split up to work without NLL
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-24 19:14:37 +02:00
nicoo
36a2948959 factor::miller_rabin: Avoid unecessary exponentiation
Instead of computing a^r and a^(n-1) = a^(r 2ⁱ) separately,
compute the latter by repeatedly squaring the former.

33.6% performance improvement
2020-05-24 19:10:34 +02:00
nicoo
543c7b941a factor::rho: Small refactor 2020-05-24 19:10:29 +02:00
nicoo
30fd6a0309 factor::numeric: Replace lose functions with an Arithmetic trait 2020-05-24 18:16:21 +02:00
nicoo
29eb8fd77b format: Make clippy happy 2020-05-24 17:06:19 +02:00
nicoo
8241037690 factor::miller_rabin: Extract dividers from the primality test
Another 36% improvement.
2020-05-24 15:41:23 +02:00
nicoo
6b9585b1dc factor::miller_rabbin: Refactor before extracting dividers
Replace iterated division with u64::trailing_zeros, hoist the selection of `mul`
out of the loop, another cool 49.5% runtime improvement.
2020-05-24 15:41:23 +02:00
nicoo
e3ecc81d97 factor: Move the Miller-Rabin primality test to its own module. 2020-05-24 15:41:23 +02:00
nicoo
74054feb94 factor::factor: Remove extraneous call to the primality test
Another 6.97% runtime improvement
2020-05-24 15:41:23 +02:00
nicoo
e1a6dbe619 factor::table: Remove obsolete, commented code 2020-05-24 15:41:23 +02:00
nicoo
169740629b factor::table: Remove extraneous calls to the primality test
50% performance improvement on factoring all numbers between 2 and 10⁶.
2020-05-24 15:41:23 +02:00
nicoo
418fd61759 factor::factor: Short-circuit the fallback to Pollard's rho
When the remainder is smaller than the max. entry in the table,
it is guaranteed to be prime.
2020-05-24 15:41:23 +02:00
nicoo
bc11e57962 factor::factor: Use u64::trailing_zero instead of iterated division
No significant performance impact (most of the time is spent elsewhere),
but an easy and satisfying fix nevertheless.
2020-05-24 15:41:23 +02:00
nicoo
a1b2522750 factor: Move each factorisation method to its own module
Also decoupled the factorisation methods; now factor::factor contains
the logic that chains the different algorithms and aggregates results.

As a side-effect, rho::factor now performs extraneous allocations (as each
recursive step creates a new `Factors` value, which is then aggregated into
the previous one) but there is no significant performance impact.
2020-05-24 15:41:23 +02:00
nicoo
d9095a2539 factor: Refactor (eheh) around a Factors datatype
It is clearer to see what is going on, as opposed to passing around an
unmarked `Vec<u64>`, and there is a single place to add invariants checks.

This is also a more compact memory representation: each prime factor is
represented only once, with an additional byte for multiplicity.  The
performance impact is however not significant.
2020-05-24 15:41:23 +02:00
Sylvestre Ledru
75b7f768ea
fix(mv): Allow move across file systems (#1524)
Co-authored-by: Arni Dagur <arni@dagur.eu>
2020-05-24 12:49:56 +02:00
Sylvestre Ledru
272b66aac8
refactor(hostname): use clap instead of getopts for consistency (#1516)
* refactor(hostname): use clap instead of getopts for consistency

* deps ~ uucore/wide is required

Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-22 17:27:03 +02:00
Sylvestre Ledru
817a237821
Merge pull request #1513 from sylvestre/uptime-since
feature(uptime): add option --since
2020-05-21 22:18:52 +02:00
Sylvestre Ledru
2fe2fe7275
be less prescriptive with clap versions (#1514) 2020-05-21 22:18:13 +02:00
Sylvestre Ledru
0a02aeda71
refactor(hostname): rely on the hostname crate (#1517) 2020-05-21 10:58:38 +02:00
Sylvestre Ledru
3994af5678
Update src/uu/uptime/src/uptime.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-21 10:58:23 +02:00
Sylvestre Ledru
340b5badda
Update src/uu/uptime/src/uptime.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-21 10:58:15 +02:00
Sylvestre Ledru
6bc9b38fa9 fix(cp): Remove an unused dep to the getops crate 2020-05-17 12:09:55 +02:00
Sylvestre Ledru
719f2bf8ae feature(uptime): add option --since
For this, I:
* moved from getops to clap
* remove the millisecond maths
2020-05-17 11:50:08 +02:00
Roy Ivy III
8e886c30dc
Merge pull request #1511 from sylvestre/more
fix(more) handle no arguments without panic; add test and a FixME
2020-05-15 19:17:01 -05:00
Sylvestre Ledru
80203a7a02 fix(more) Return a proper error message when no argument is provided
Fix #1509
2020-05-15 17:48:35 -05:00
Roy Ivy III
9052bc4de7
Merge pull request #1503 from sylvestre/arch
test(arch): add tests and description text
2020-05-10 20:11:10 -05:00
Anuvrat Parashar
ce064dc62e feature(head): Introduce NLines to handle negative lines parameters 2020-05-10 21:32:48 +02:00
Sylvestre Ledru
1565f4d1d9
Update src/uu/arch/src/arch.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-10 21:05:38 +02:00