* exit with code 1 when no arguments
* add a test for no arguments.
* Update test_sed.rs
* cargo fmt
* pass -n for missing script arguments test
Issue: #274
PR: #409
* fix: remove newline swap in exchange and swap content only
* fix: support non empty hold spaces and newline appended hold spaces
* nit: period in comment
* nit: useless comment removal
* chore: clarify newline swap logic for `x`
Keep using regex_fancy for regexes containing backreferences.
This removes a complex unneeded matcher selection RE and also
provides an overall small performance boost.
access-log-no-del pre-use-bytes is 1.02 times faster than use-re-bytes
access-log-all-del use-re-bytes is 1.02 times faster than pre-use-bytes
access-log-translit pre-use-bytes is similarly fast as use-re-bytes
access-log-complex-sub pre-use-bytes is similarly fast as use-re-bytes
access-log-append pre-use-bytes is similarly fast as use-re-bytes
remove-cr use-re-bytes is 1.08 times faster than pre-use-bytes
genome-subst use-re-bytes is 1.05 times faster than pre-use-bytes
number-fix pre-use-bytes is 1.02 times faster than use-re-bytes
long-script use-re-bytes is 1.01 times faster than pre-use-bytes
hanoi pre-use-bytes is similarly fast as use-re-bytes
factorial use-re-bytes is 1.03 times faster than pre-use-bytes
Suggested by: Andrew Gallant @BurntSushi
On file systems supporting reflinks or extent remapping, such
as XFS, Btrfs, NFS, regions of files that are not modified are
processed without any copying — with O(1) cost.
While at it:
- Correct the use of write(2) to handle partial writes and
report appropriate errors.
- Improve buffer sizing.
These are the benchmark results
no-op-short copy-file-range is 1.17 times faster than main
access-log-no-op copy-file-range is 2.91 times faster than main
access-log-no-subst copy-file-range is 1.56 times faster than main
access-log-subst copy-file-range is 1.03 times faster than main
access-log-no-del copy-file-range is 1.59 times faster than main
access-log-all-del copy-file-range is 1.06 times faster than main
access-log-translit copy-file-range is 1.05 times faster than main
access-log-complex-sub copy-file-range is 1.04 times faster than main
access-log-append copy-file-range is 1.05 times faster than main
remove-cr copy-file-range is 1.03 times faster than main
genome-subst copy-file-range is 1.08 times faster than main
number-fix copy-file-range is 1.03 times faster than main
long-script main is similarly fast as copy-file-range
hanoi main is 1.03 times faster than copy-file-range
factorial copy-file-range is 1.03 times faster than main
On suported file systems (XFS, BTRFS), output files with no or few in-place
modifications share large blocks with the input file, as can be seen
in the following example.
$ xfs_io -c 'fiemap -v' lines.txt
lines.txt:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..857199]: 11917304..12774503 857200 0x2000
1: [857200..857207]: 12774504..12774511 8 0x1
Instead, detect and handle runtime errors at the point where regex
methods are called.
This is always faster or the same as the preceding method.
no-op-short current is 1.03 times faster than preceding
access-log-no-op current is similarly fast as preceding
access-log-no-subst current is 1.05 times faster than preceding
access-log-subst current is similarly fast as preceding
access-log-no-del current is 1.05 times faster than preceding
access-log-all-del current is 1.04 times faster than preceding
access-log-translit current is similarly fast as preceding
access-log-complex-sub current is similarly fast as preceding
remove-cr current is 1.03 times faster than preceding
genome-subst current is similarly fast as preceding
number-fix current is similarly fast as preceding
long-script current is 1.01 times faster than preceding
hanoi current is 1.02 times faster than preceding
factorial current is similarly fast as preceding
Also, this rectified most performance pessimization introduced by adding
error locations in fast_regex.
no-op-short previous is 1.07 times faster than error-loc
access-log-no-op previous is similarly fast as error-loc
access-log-no-subst error-loc is 1.04 times faster than previous
access-log-subst previous is similarly fast as error-loc
access-log-no-del error-loc is 1.03 times faster than previous
access-log-all-del error-loc is 1.04 times faster than previous
access-log-translit previous is 1.06 times faster than error-loc
access-log-complex-sub error-loc is 1.02 times faster than previous
remove-cr previous is similarly fast as error-loc
genome-subst previous is 1.04 times faster than error-loc
number-fix previous is 1.06 times faster than error-loc
long-script previous is similarly fast as error-loc
hanoi previous is similarly fast as error-loc
factorial previous is similarly fast as error-loc
TODO: In fast_regex distinguish between UTF-8 conversion and regex
errors. The former should be reported as I/O errors with input file
location info, which the latter should be reported as script errors
with script file location info.