Commit graph

3137 commits

Author SHA1 Message Date
Roy Ivy III
f7ac89dc82 dev ~ update show-utils for 'coreutils' name change 2020-05-29 22:59:47 -05:00
Roy Ivy III
52ae491fcd change ~ rename base binary to 'coreutils' 2020-05-29 22:59:47 -05:00
Roy Ivy III
f7f872f7ea maint/build ~ fix cargo-make format (Makefile.toml) 2020-05-29 22:59:47 -05:00
Roy Ivy III
8a91f1dea4 tests/stat ~ fix testing algorithm to correctly allow unknown values (with/without trailing newlines) 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
785bac49b8 docs ~ comment polish (Cargo.toml) 2020-05-29 22:59:46 -05:00
Roy Ivy III
82f825c649 maint/build ~ improve cargo make 'util' from generic to platform specific 2020-05-29 22:59:46 -05:00
Roy Ivy III
c6ca0437c0 maint/build ~ update show-utils utilities from transitional to more-user friendly outputs 2020-05-29 22:59:46 -05:00
Roy Ivy III
02694bb389 maint/build ~ update cargo make 'util' target to work with new independant crates ('uu_...') 2020-05-29 22:59:46 -05:00
Roy Ivy III
01f3e87393 maint/build ~ narrow cargo make help output as possible 2020-05-29 22:59:46 -05:00
Roy Ivy III
72b7e1b20c maint/build ~ slim down cargo make util(s) targets 2020-05-29 22:59:46 -05:00
Roy Ivy III
b1a8f6c94c maint/build ~ add cargo make 'build-release' target 2020-05-29 22:59:46 -05:00
Roy Ivy III
f8123ecd9a maint/build ~ slim down cargo make examples targets 2020-05-29 22:59:46 -05:00
Roy Ivy III
1fe7cc5595 build/fix ~ (build.rs) fix 'feature => sub-crate/util' translation logic + improved output formatting 2020-05-29 22:59:46 -05:00
Roy Ivy III
0cb5fbd6b5 change ~ remove transition-only and unneeded code for independent sub-crates 2020-05-29 22:59:46 -05:00
Roy Ivy III
f051f62445 change ~ add work-around for crate name collisions
- imported crate name collisions bypass implemented

## [why]

There may be some core or external crates required/used by this project that collide with
uutil names. For example, the `test` util collides with the rust core crate 'test' which
is used behind the scenes for testing. Without the renaming scheme used here, cryptic and
fatal compiler errors occur when compiling the integration tests.
2020-05-29 22:59:46 -05:00
Roy Ivy III
db2e950918 change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00
Roy Ivy III
68bea8d81d maint/build ~ update show-utils for sub-crate independence transition 2020-05-29 22:59:40 -05:00
Roy Ivy III
3291f9d4db deps ~ update uucore dependency (removing patch configuration) 2020-05-29 22:59:33 -05:00
Roy Ivy III
d9de816757
maint/build ~ allow code coverage upload failures without breaking the build (warning instead of error) (#1526) 2020-05-25 22:47:42 +02:00
Roy Ivy III
53ee25693f
Merge pull request #1500 from rivy/chg.uutils-naming
Change ~ allow alternate names for `uutils`
2020-05-25 00:16:40 -05:00
Roy Ivy III
b0361c2b64 build/dev ~ add EditorConfig file to suggest whitespace standards 2020-05-24 17:29:08 -05:00
Roy Ivy III
bbb23537c2 maint/dev ~ add test-repo-whitespace.BAT dev utility 2020-05-24 17:29:08 -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
3877cf4bd3 maint/deps ~ pin unstable 'textwrap' crate (marked for later review)
## [why]

'textwrap' is currently unstable, with "term_size" being an undocumented, but required,
feature. The feature name has already changed within the repository 'master' branch.
But that branch has never been pushed to a new version.

Pin for now with "!maint" mark and comment.
2020-05-24 17:29:07 -05:00
Roy Ivy III
8263d31fbb change ~ improve help display for main multi-call binary 2020-05-24 17:29:07 -05:00
Roy Ivy III
c457dfbbc4 fix/uutils ~ support function/util (aka, applet) symlink aliasing where possible
## [why]

`std::env::current_exe()` has platform dependent behavior and will often
return the target binary, not the symlink name, when the binary is executed
via symlink. So, to support symlinking, the first (0th) arg from `std::env::args()`
is used, when possible, with fallback to `std::env::current_ext()` if args are
missing or empty.

- ref: <https://github.com/rust-lang/rust/issues/43617>
2020-05-24 17:29:07 -05:00
Roy Ivy III
e759e852a9 maint/build ~ add cargo make build-examples targets 2020-05-24 17:29:07 -05:00
Roy Ivy III
bcdff338fb add busybox and uu examples (both equivalent to uutils) 2020-05-24 17:29:07 -05:00
Roy Ivy III
bebf36bffb change/uutils ~ allow (almost) any name for the multi-binary container
- final multi-binary will now function correctly with any binary/executable name
- multi-binary container acts as the specified util IF EITHER ...
  1. the binary/executable name exactly matches the name of an applet/util
  2. the binary/exectuable name matches <PREFIX><UTIL_NAME> pattern
     * where the PREFIX is any string ending in a non-alphanumeric character
2020-05-24 17:29:07 -05:00
Roy Ivy III
100fc8d1e0 maint/deps ~ improve dependency reference for the 'rust-users' external crate 2020-05-24 17:29:07 -05:00
Roy Ivy III
6880938955 maint/deps ~ refactor/rename pinned 'backtrace' with leading '_' to show lack of local use 2020-05-24 17:29:06 -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