From 5e61386a8310284f42962d43f27d3a563034e4c5 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sun, 20 Mar 2022 15:49:00 +0000 Subject: [PATCH] Use ArcIntern and CompactString as needed --- Cargo.lock | 83 ++++++++++++++++++++++++-- quickpeep_raker/Cargo.toml | 2 + quickpeep_raker/src/bin/qp-seedrake.rs | 13 ++-- 3 files changed, 86 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3cc2fe7..f269262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,6 +48,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +dependencies = [ + "const-random", +] + [[package]] name = "ahash" version = "0.7.6" @@ -80,6 +89,18 @@ version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +[[package]] +name = "arc-interner" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655ae79d4a7661f2f9a8f6daf95af32897eafdea938df06aeb127cea02b5f4ac" +dependencies = [ + "ahash 0.3.8", + "dashmap", + "once_cell", + "serde", +] + [[package]] name = "askama" version = "0.11.1" @@ -438,6 +459,28 @@ dependencies = [ "crossterm", ] +[[package]] +name = "const-random" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" +dependencies = [ + "getrandom 0.2.5", + "lazy_static", + "proc-macro-hack", + "tiny-keccak", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -573,6 +616,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "cssparser" version = "0.27.2" @@ -977,7 +1026,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] @@ -2180,7 +2229,7 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55586aa936c35f34ba8aa5d97356d554311206e1ce1f9e68fe7b07288e5ad827" dependencies = [ - "ahash", + "ahash 0.7.6", "metrics-macros 0.4.1", ] @@ -2190,7 +2239,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e52eb6380b6d2a10eb3434aec0885374490f5b82c8aaf5cd487a183c98be834" dependencies = [ - "ahash", + "ahash 0.7.6", "metrics-macros 0.5.1", ] @@ -2857,6 +2906,7 @@ version = "0.1.0" dependencies = [ "adblock", "anyhow", + "arc-interner", "bare-metrics-recorder", "bytes", "chrono", @@ -2891,6 +2941,7 @@ dependencies = [ "serde", "serde_bare", "sitemap", + "smartstring", "tokio", "toml", ] @@ -3428,6 +3479,15 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +[[package]] +name = "smartstring" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea958ad90cacc8ece7f238fde3671e1b350ee1741964edf2a22fd16f60224163" +dependencies = [ + "static_assertions", +] + [[package]] name = "socket2" version = "0.4.4" @@ -3480,7 +3540,7 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "195183bf6ff8328bb82c0511a83faf60aacf75840103388851db61d7a9854ae3" dependencies = [ - "ahash", + "ahash 0.7.6", "atoi", "bitflags", "byteorder", @@ -3554,6 +3614,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_cache" version = "0.8.3" @@ -3709,6 +3775,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.5.1" diff --git a/quickpeep_raker/Cargo.toml b/quickpeep_raker/Cargo.toml index ce468e8..0f34960 100644 --- a/quickpeep_raker/Cargo.toml +++ b/quickpeep_raker/Cargo.toml @@ -46,6 +46,8 @@ ouroboros = "0.14.2" rand = "0.8.5" lru = "0.7.3" diplomatic-bag = "0.2.0" +arc-interner = "0.7.0" +smartstring = "1.0.0" ### Raking helpers # HTTP Requests diff --git a/quickpeep_raker/src/bin/qp-seedrake.rs b/quickpeep_raker/src/bin/qp-seedrake.rs index ab811ff..7d68541 100644 --- a/quickpeep_raker/src/bin/qp-seedrake.rs +++ b/quickpeep_raker/src/bin/qp-seedrake.rs @@ -4,7 +4,10 @@ use std::collections::BTreeSet; use env_logger::Env; use anyhow::{bail, Context}; -use std::path::{Path, PathBuf}; +use arc_interner::ArcIntern; +use smartstring::alias::CompactString; + +use std::path::{PathBuf}; use tokio::sync::mpsc::{Receiver, Sender}; use quickpeep_raker::config; @@ -53,15 +56,9 @@ pub async fn main() -> anyhow::Result<()> { Ok(()) } -// TODO use the smart string -type SmartString = String; - -// TODO use the arc interner -type ArcIntern = T; - pub struct Seed { url: UrlOrUrlPattern, - tags: ArcIntern>, + tags: ArcIntern>, } /// Either a URL or a URL prefix.