2017-07-23 05:32:18 +00:00
|
|
|
# word-count
|
|
|
|
|
2019-03-22 13:07:33 +00:00
|
|
|
Demonstrates searching for a file in plain python, with rust singlethreaded and with rust multithreaded.
|
2018-07-30 20:52:22 +00:00
|
|
|
|
2017-07-23 05:32:18 +00:00
|
|
|
## Build
|
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
```shell
|
2017-07-23 05:32:18 +00:00
|
|
|
python setup.py install
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```python
|
2018-07-30 20:52:22 +00:00
|
|
|
from word_count import search_py, WordCounter
|
2017-07-23 05:32:18 +00:00
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
search_py("path/to/file", "word")
|
|
|
|
WordCounter("path/to/file").search("word")
|
|
|
|
WordCounter("path/to/file").search_sequential("word")
|
2017-07-23 05:32:18 +00:00
|
|
|
```
|
2018-07-30 20:52:22 +00:00
|
|
|
|
|
|
|
## Benchmark
|
|
|
|
|
2018-12-28 19:29:12 +00:00
|
|
|
Install the depedencies:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
There is a benchmark in `tests/test_word_count.py`:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
pytest -v tests
|
2018-10-09 16:21:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
2020-11-09 21:46:25 +00:00
|
|
|
To test install tox globally and run
|
2018-10-09 16:21:52 +00:00
|
|
|
|
|
|
|
```shell
|
2020-11-09 21:46:25 +00:00
|
|
|
tox -e py
|
2018-12-28 19:29:12 +00:00
|
|
|
```
|