From c26927a265f02916ef61bafb9ba33fa0d48b242c Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 1 Dec 2024 22:32:23 +0100 Subject: [PATCH] Forking & Threading. --- bench.py | 2 +- isspam | Bin 33136 -> 37312 bytes retoor_c/isspam.c | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bench.py b/bench.py index 0e93ff0..9aa7eb2 100644 --- a/bench.py +++ b/bench.py @@ -6,6 +6,6 @@ time_start = time.time() subprocess.check_output('./isspam books/*.txt', shell=True) print("Time C:",time.time() - time_start) time_start = time.time() -subprocess.check_output('./risspam books/*.txt', shell=True) +subprocess.check_output('./risspam -p books/*.txt', shell=True) print("Time Rust:",time.time() - time_start) print("***end benchmark***") diff --git a/isspam b/isspam index adb20b9a2006c43520bc06695e3109bfe0c0503e..2674267526a8be2f1ee52c578cc2793050925b6d 100755 GIT binary patch delta 8371 zcmZ`;3tUuH{=etKz(6nqDh;Rz*g*K;G57-IH9YK&jfSa-B7#{Yg^D$54{fl){#?e{ z)z0R&ySmYCwYgiHMO)gsIfi0uS!gd!O|-N-;RDT&xt2Ts?>YBgVfpX>d_Hr3=l49n z^EMa*F;@@;MEAq886?rX<4kDTM-Y6B-p`ghUki+mh z(xCDO!X=?9y^^jYmO;ImR3B{rGbtn~1GRKKJw(+`rx78`hdi_P_?(9V3s1hLJn(k> z=fC{@*_y;`x*;SzAq7&pBLaCrXc7dG(MHmPAywp`G&a;i+NeD=i%g^|P`{T^Xj^DJ zF*BTYp_autck}ORu5l}`?}DC%6!7}{oIa1&f6Z<94e`XlaN29gCa-b+Tm1VW*BcIA z7HQ^`)BIb{zt6L;;VSp>4RJ8-4vQzp=)b~Tp>@k2euy@NJHsAvJ-m34tNoqu#Uwlg zF(yI?O^mQq*Py3b@C8>weFTety+#{SUmq<924SU!zqM&I1}9W-Yxv5cOg=yyV9YJl87MdMtj4d9( z8ATUC&!*{B4B$?ro50P}xU~bg`E(Ds#TvJ90Jnr*0@tB&n+9-a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 100644 --- a/retoor_c/isspam.c +++ b/retoor_c/isspam.c @@ -313,12 +313,14 @@ int main(int argc, char *argv[]) { if (argc > 1) { for (int i = 1; i < argc; i++) { - + pid_t pid = fork(); + if(!pid){ printf("File: %s\n", argv[i]); analyze_file(argv[i]); printf("\n"); - + return 0; + } } return 0;