From 82e2a49cdc3b729ffe68676795fe2bb15fa65757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Gr=C3=BCnewald?= Date: Tue, 10 Dec 2024 21:20:54 +0100 Subject: [PATCH] Remove rayon --- .gitignore | 1 + Cargo.lock | 46 ---------------------------------------------- Cargo.toml | 1 - src/main.rs | 7 ++----- 4 files changed, 3 insertions(+), 52 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock index 23af9f5..83614db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,31 +192,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - [[package]] name = "deranged" version = "0.3.11" @@ -941,26 +916,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" version = "0.5.7" @@ -1278,7 +1233,6 @@ version = "0.1.0" dependencies = [ "chrono", "maud", - "rayon", "rocket", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 16902cb..6d02a92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,3 @@ serde_json = "1.0" rocket = "0.5" maud = { version = "0.26", features = ["rocket"] } chrono = "0.4" -rayon = "1.10" diff --git a/src/main.rs b/src/main.rs index aae644b..9a1c3cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ use maud::{html, Markup, DOCTYPE}; use rocket::{Rocket,Build,launch,get,routes,fs::{FileServer}}; use std::collections::HashMap; use chrono::prelude::*; -use rayon::prelude::*; #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] @@ -112,15 +111,13 @@ fn index() -> Markup { ).expect("Could not parse result.json"); println!("Done!"); - let messages: Vec = tg_export_result.messages.into_par_iter().filter(|m| { + let mut messages: Vec = tg_export_result.messages.into_iter().filter(|m| { return if let Some(media_type) = &m.media_type { *media_type == MediaType::Sticker } else { false } - }).collect(); - - let mut messages: Vec = messages.into_iter().fold(HashMap::new(), |mut acc: HashMap, message| { + }).fold(HashMap::new(), |mut acc: HashMap, message| { let file = message.file.as_ref().expect("No file").to_owned(); if acc.contains_key(&file) { if let Some(scored_chat_message) = acc.get_mut(&file) {