fast-replace/bash-fast-replace/README.md

43 lines
753 B
Markdown
Raw Normal View History

2023-12-30 21:35:09 +00:00
# Bash Fast Replace
An implementation in bash.
## Usage
To create the corpus.csv and pairs.csv files. And perform the replacements:
2023-12-30 21:41:51 +00:00
```shell
2023-12-30 21:35:09 +00:00
make install # create corpus and pairs
make run # create file with the replaced values
```
Then to test:
2023-12-30 21:41:51 +00:00
```shell
2023-12-30 21:35:09 +00:00
make test # Checks that the replacement worked
```
## Conclusions
`shuf` is amazing. Using /dev/urandom directly produces broken pipe errors on when using Make.
Speed is not great... But no surprize there.
2023-12-30 21:41:51 +00:00
````shell
2023-12-30 21:35:09 +00:00
$ make install
./bin/pairs.sh
Generating csv/pairs.csv...
The generation of 1000 pairs took 2s
./bin/corpus.sh
Generating csv/corpus.csv...
generated in 3s
$ make run
./bin/replace.sh
Generating replaced.csv...
Replacement took 3s
$ make test
./bin/test.sh
test OK
````