|
for https://retoor.molodetz.nl/retoor/isspam
|
|
|
|
https://snek.molodetz.nl/terminal.html ubuntu running thing instructions:
|
|
```
|
|
mkdir /project
|
|
cd /project
|
|
git clone https://retoor.molodetz.nl/retoor/isspam.git
|
|
apt install valgrind curl
|
|
export RUSTUP_HOME=/project/.rustup
|
|
export CARGO_HOME=/project/.cargo
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
. "/project/.cargo/env"
|
|
cd isspam
|
|
rustup install nightly
|
|
rustup default nightly
|
|
make
|
|
make benchmark
|
|
python3 bench.py
|
|
```
|
|
|
|
clone: `git clone https://gitlab.com/jestdotty-group/draft/jisspam.git jest_rust`
|
|
|
|
edit make: `vi makefile` and add build:
|
|
```
|
|
build_jest:
|
|
@echo "compiling jest_rust project"
|
|
cd jest_rust && cargo build --release && cp target/release/jisspam ..
|
|
```
|
|
append to all script:
|
|
```
|
|
all: build run valgrind build_risspam run_risspam build_cpp build_borded_cpp build_py build_jest
|
|
```
|
|
|
|
add to bench: `vi bench.py`
|
|
```py
|
|
time_start = time.time()
|
|
subprocess.check_output('./jisspam books/*.txt', shell=True)
|
|
print("Time Jest Rust:", time.time() - time_start)
|
|
```
|
|
|
|
run: `python3 bench.py`
|
|
output looks something like this:
|
|
```
|
|
***benchmarking***
|
|
Time C: 31.315868377685547
|
|
Time Rust: 41.232205867767334
|
|
Time CPP: 20.1683189868927
|
|
Time Borded CPP: 15.468477964401245
|
|
Time Jest Rust: 54.74523115158081
|
|
Time Retoor Python: 287.63036131858826
|
|
***end benchmark***
|
|
```
|
|
|
|
add `/jisspam` to `.gitignore` to not commit the executable accidentally
|
|
|
|
# local machine benchmarks
|
|
|
|
single threaded:
|
|
```
|
|
***benchmarking***
|
|
Time C: 2.4082751274108887
|
|
Time Rust: 2.865687847137451
|
|
Time CPP: 1.1568822860717773
|
|
Time Borded CPP: 1.9657189846038818
|
|
Time Jest Rust: 33.63373279571533
|
|
Time Retoor Python: 133.92413425445557
|
|
***end benchmark***
|
|
```
|
|
|
|
rayon:
|
|
```
|
|
***benchmarking***
|
|
Time C: 2.457853317260742
|
|
Time Rust: 3.0170154571533203
|
|
Time CPP: 1.1482579708099365
|
|
Time Borded CPP: 2.002591371536255
|
|
Time Jest Rust: 4.294418811798096
|
|
Time Retoor Python: 201.2997748851776
|
|
***end benchmark***
|
|
```
|
|
|
|
tokio:
|
|
```
|
|
***benchmarking***
|
|
Time C: 2.448648452758789
|
|
Time Rust: 3.095592737197876
|
|
Time CPP: 1.1662013530731201
|
|
Time Borded CPP: 1.9207634925842285
|
|
Time Jest Rust: 4.717588901519775
|
|
Time Retoor Python: 139.8203284740448
|
|
***end benchmark***
|
|
```
|
|
lto not thin: `Time Jest Rust: 5.306957483291626` slower
|
|
lto fat: `Time Jest Rust: 5.413678407669067` slower
|
|
codegen-units 1: `Time Jest Rust: 4.451631546020508` faster
|
|
opt-level z: `Time Jest Rust: 7.045313119888306` slower
|
|
strip true: `Time Jest Rust: 4.337219476699829` faster
|
|
lto true: `Time Jest Rust: 4.703521728515625` slower
|
|
lto none: `Time Jest Rust: 4.817203998565674`
|
|
lto thin: `Time Jest Rust: 4.429729223251343` faster |