Sylvestre Ledru
61520546a5
refactor(rm): Move to clap + add a test
2020-11-09 10:27:58 +01:00
Sylvestre Ledru
a3f3a050a8
Merge pull request #1618 from sylvestre/wc-clap
...
refactor(wc): use clap instead of getopts
2020-11-03 09:39:53 +01:00
Sylvestre Ledru
38e90b9a03
Merge pull request #1621 from sylvestre/clap-stat
...
refactor(stat): Move to clap
2020-11-03 08:37:39 +01:00
Sylvestre Ledru
57c83db6b6
Merge pull request #1616 from sylvestre/users
...
refactor(users): move to clap and simplify the code a bit
2020-11-03 08:37:16 +01:00
Sylvestre Ledru
bd41cb621b
Merge pull request #1620 from sylvestre/clap-printenv
...
refactor(printenv): use clap instead of getopts
2020-11-03 08:36:56 +01:00
Sylvestre Ledru
32ccd7d54d
Merge pull request #1619 from sylvestre/rmdir-clap
...
refactor(rmdir): use clap instead of getopts
2020-11-03 08:36:25 +01:00
Sylvestre Ledru
daf0f96b94
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:47:55 +01:00
Sylvestre Ledru
2ad587ccbd
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:32:44 +01:00
Sylvestre Ledru
1e37c29b1f
refactor(stat): Move to clap
2020-11-02 22:18:51 +01:00
Sylvestre Ledru
58099f4203
refactor(wc): use clap instead of getopts
2020-10-29 20:40:00 +01:00
Roy Ivy III
114fda0519
tests ~ (sub-crate factor) refactor divisor() test for improved readability
2020-10-26 15:06:29 -05:00
Roy Ivy III
ae06368cd8
polish/factor ~ correct spelling
2020-10-26 15:06:29 -05:00
Roy Ivy III
6a525c950d
perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)
2020-10-26 15:06:29 -05:00
Roy Ivy III
6eea8c5f30
perf/factor ~ improve factor() quotient and loop comparison (~6% time improvement)
2020-10-26 15:06:28 -05:00
Roy Ivy III
368f47381b
fix/factor ~ fix fault when factoring number composed of a squared factor
2020-10-26 15:06:28 -05:00
Roy Ivy III
8593b4c46c
tests ~ (sub-crate/factor) add tests for known prior factorization failures
2020-10-26 15:06:28 -05:00
Roy Ivy III
3bb3080170
factor/refactor ~ fix cargo clippy
complaints (allow many_single_char_names)
2020-10-26 15:06:28 -05:00
nicoo
0d39732300
factor::Decomposition: Inline a small number (4) of factors
...
This avoids allocating on the heap when factoring most numbers,
without using much space on the stack.
This is ~3.5% faster than the previous commit, and ~8.3% faster than “master”.
2020-10-26 15:06:28 -05:00
nicoo
78ae0cca31
factor: Slightly refactor main loop, fix bug
2020-10-26 15:06:28 -05:00
nicoo
b7b0c76b8e
factor::Decomposition: Optimise as a factor is never added twice
...
The invariant is checked by a debug_assert!, and follows from the previous
commit, as `dec` and `factors` only ever contains coprime numbers:
- true at the start: factor = ∅ and dec = { n¹ } ;
- on every loop iteration, we pull out an element `f` from `dec` and either:
- discover it is prime, and add it to `factors` ;
- split it into a number of coprime factors, that get reinserted into `dec`;
the invariant is maintained, as all divisors of `f` are coprime with all
numbers in `dec` and `factors` (as `f` itself is coprime with them.
As we only add elements to `Decomposition` objects that are coprime with the
existing ones, they are distinct.
2020-10-26 15:06:28 -05:00
nicoo
ce218e01b6
factor: Ensure we only need to find every single factor once [WiP]
...
~17% faster, many optimisation opportunities still missed >:)
2020-10-26 15:06:28 -05:00
nicoo
3743a3e1e7
factor: Derecursify and refactor
...
~7% slowdown, paves the way for upcoming improvements
2020-10-26 15:06:28 -05:00
nicoo
8643489096
factor::Factors: Use a RefCell rather than copy data when printing
...
~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-10-26 15:06:28 -05:00
nicoo
30f9cf32f2
factor::Decomposition: Use a flat vector representation
...
~18% faster than BTreeMap, and ~5% faster than 'master'
2020-10-26 15:06:27 -05:00
nicoo
b8ef58c002
factor::Factors: Split off a Decomposition type
...
The new type can be used to represent in-progress factorisations,
which contain non-prime factors.
2020-10-26 15:06:27 -05:00
nicoo
6158cd5714
factor: Introduce a type alias for exponents
...
This way, we can easily replace u8 with a larger type when moving to support
larger integers.
2020-10-26 15:06:27 -05:00
Sylvestre Ledru
af151703b3
refactor(rmdir): use clap instead of getopts
2020-10-26 09:53:55 +01:00
Sylvestre Ledru
17a99f8e53
refactor(printenv): use clap instead of getopts
2020-10-26 09:52:53 +01:00
Roy Ivy III
5837bc4fc9
Merge pull request #1610 from sylvestre/sort-clap
...
refactor(sort): move to use of 'clap'
2020-10-25 18:56:58 -05:00
Roy Ivy III
a9fb64abb4
Merge pull request #1612 from sylvestre/clap-seq
...
Move seq to use of 'clap'
2020-10-25 18:56:24 -05:00
Sylvestre Ledru
dc4eb79329
refactor/sort ~ changes based on PR feedback
...
- change `const`=>`static` and remove unneeded help/version (supplied by default by `clap`)
- update of the ABOUT description
- move to alphabetical order (where reasonable)
- rename OPT_FILES => ARG_FILES
- change the order of the declarations
2020-10-25 11:14:15 -05:00
Sylvestre Ledru
7fb5aaa108
only one file is allowed
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 17:07:32 +01:00
Sylvestre Ledru
bd339f142e
Improve the "about" description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 17:07:17 +01:00
Sylvestre Ledru
58b0aeabee
refactor(sort): move to clap
2020-10-25 11:01:30 -05:00
Sylvestre Ledru
75e1c517a0
refactor/seq ~ changes based on PR feedback
...
- fix the ABOUT description
- rename OPT_NUMBERS => ARG_NUMBERS
- improve the get_usage of seq
- rename seq => incremetal
- `cargo fmt`
2020-10-25 10:58:14 -05:00
Sylvestre Ledru
e06aaace59
refactor/readline ~ changes based on PR feedback
...
- add a trailing "." to ABOUT for consistency
- rename OPT_FILES => ARG_FILES
- move to alphabetical order for OPTIONs (where reasonable)
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 10:54:24 -05:00
Sylvestre Ledru
733fe925ad
refactor(readlink): move to clap
2020-10-25 10:53:09 -05:00
Sylvestre Ledru
dfb922f66e
refactor(seq): use clap instead of doing arg mgmt by hand
2020-10-25 10:46:38 -05:00
Roy Ivy III
58d7d89e07
Merge pull request #1617 from sylvestre/clippy-fix
...
Fix some clippy warnings
2020-10-25 10:35:35 -05:00
Sylvestre Ledru
a12509f32e
Fix some clippy warnings
2020-10-25 15:50:51 +01:00
Sylvestre Ledru
4804e52c97
refactor(users): move to clap and simplify the code a bit
2020-10-25 15:29:02 +01:00
Sylvestre Ledru
7c3dccb981
remove the useless format
2020-10-25 12:28:27 +01:00
Sylvestre Ledru
0d4e36d5cd
reorder the args
2020-10-25 12:27:04 +01:00
Sylvestre Ledru
b72972e0b2
Rename OPT_FILES => ARG_FILES
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 12:22:07 +01:00
Sylvestre Ledru
8ad2fd3534
refactor(truncate): Move to clap
2020-10-23 00:40:46 +02:00
Kevin Burke
7fc1b16115
sort: fix panic on write to closed pipe
...
If the output of sort is piped to another program that closes the file
descriptor, sort currently panics. The GNU coreutils is able to handle
this case.
Replacing panic with crash_if_err reports the closed pipe and exits
with a return code, which seems like the correct behavior. Tested on
my Mac and the panic disappears.
Add a test which pipes data to sort - it won't protect against this
specific regression, but it increases the test coverage, at least.
Fixes #1608 .
2020-10-21 16:55:10 -07:00
Roy Ivy III
92075c7d14
refactor/polish ~ (factor) fix cargo clippy
complaint (unused_imports)
2020-10-16 20:25:49 -05:00
Sylvestre Ledru
fba62f39c6
Merge pull request #1603 from rivy/fix.warnings
...
Fix `cargo clippy` warnings
2020-10-12 09:23:15 +02:00
Roy Ivy III
77a04546f0
fix/printf ~ use calculated VERSION
2020-10-11 17:39:50 -05:00
Roy Ivy III
46f30f3836
refactor/polish ~ fix cargo clippy
complaint (stable_sort_primitive)
2020-10-10 20:35:35 -05:00