Replace num_cpus crate with stdlib alternative.

This commit is contained in:
parazyd
2023-05-19 09:59:55 +02:00
parent 4f9e3c902e
commit 6cddfac05f
10 changed files with 137 additions and 193 deletions

303
Cargo.lock generated
View File

@@ -38,6 +38,17 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "ahash"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.0.1" version = "1.0.1"
@@ -261,7 +272,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -306,7 +317,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -477,9 +488,9 @@ checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b"
[[package]] [[package]]
name = "bytecheck" name = "bytecheck"
version = "0.6.10" version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f" checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627"
dependencies = [ dependencies = [
"bytecheck_derive", "bytecheck_derive",
"ptr_meta", "ptr_meta",
@@ -488,9 +499,9 @@ dependencies = [
[[package]] [[package]]
name = "bytecheck_derive" name = "bytecheck_derive"
version = "0.6.10" version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5" checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -661,9 +672,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "4.2.2" version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36774babb166352bb4f7b9cb16f781ffa3439d2a8f12cd31bea85a38c888fea3" checksum = "1594fe2312ec4abf402076e407628f5c313e54c32ade058521df4ee34ecac8a8"
dependencies = [ dependencies = [
"clap 4.2.7", "clap 4.2.7",
] ]
@@ -677,7 +688,7 @@ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -695,16 +706,6 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
dependencies = [
"termcolor",
"unicode-width",
]
[[package]] [[package]]
name = "color_quant" name = "color_quant"
version = "1.1.0" version = "1.1.0"
@@ -739,15 +740,15 @@ dependencies = [
[[package]] [[package]]
name = "console" name = "console"
version = "0.15.5" version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" checksum = "d0525278dce688103060006713371cedbad27186c7d913f33d866b498da0f595"
dependencies = [ dependencies = [
"encode_unicode 0.3.6", "encode_unicode 0.3.6",
"lazy_static", "lazy_static",
"libc", "libc",
"unicode-width", "unicode-width",
"windows-sys 0.42.0", "windows-sys 0.45.0",
] ]
[[package]] [[package]]
@@ -890,7 +891,7 @@ checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73"
dependencies = [ dependencies = [
"cranelift-entity", "cranelift-entity",
"fxhash", "fxhash",
"hashbrown", "hashbrown 0.12.3",
"indexmap", "indexmap",
"log", "log",
"smallvec", "smallvec",
@@ -1129,50 +1130,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "cxx"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93"
dependencies = [
"cc",
"cxxbridge-flags",
"cxxbridge-macro",
"link-cplusplus",
]
[[package]]
name = "cxx-build"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b"
dependencies = [
"cc",
"codespan-reporting",
"once_cell",
"proc-macro2",
"quote",
"scratch",
"syn 2.0.15",
]
[[package]]
name = "cxxbridge-flags"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb"
[[package]]
name = "cxxbridge-macro"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.15",
]
[[package]] [[package]]
name = "darkfi" name = "darkfi"
version = "0.4.1" version = "0.4.1"
@@ -1218,12 +1175,12 @@ dependencies = [
"sled", "sled",
"sled-overlay", "sled-overlay",
"smol", "smol",
"socket2 0.5.2", "socket2 0.5.3",
"sqlx", "sqlx",
"structopt", "structopt",
"structopt-toml", "structopt-toml",
"thiserror", "thiserror",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
"wasmer", "wasmer",
"wasmer-compiler-singlepass", "wasmer-compiler-singlepass",
@@ -1399,7 +1356,7 @@ dependencies = [
"smol", "smol",
"structopt", "structopt",
"structopt-toml", "structopt-toml",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
] ]
@@ -1447,7 +1404,7 @@ dependencies = [
"ident_case", "ident_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -1469,7 +1426,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
dependencies = [ dependencies = [
"darling_core 0.20.1", "darling_core 0.20.1",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -1479,7 +1436,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"hashbrown", "hashbrown 0.12.3",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.7", "parking_lot_core 0.9.7",
@@ -1574,12 +1531,11 @@ dependencies = [
"darkfi-serial", "darkfi-serial",
"easy-parallel", "easy-parallel",
"log", "log",
"num_cpus",
"serde", "serde",
"serde_json", "serde_json",
"simplelog", "simplelog",
"smol", "smol",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
] ]
@@ -1697,7 +1653,6 @@ dependencies = [
"easy-parallel", "easy-parallel",
"hex", "hex",
"log", "log",
"num_cpus",
"rand", "rand",
"serde", "serde",
"serde_json", "serde_json",
@@ -1853,7 +1808,7 @@ dependencies = [
"darling 0.20.1", "darling 0.20.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -2204,7 +2159,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -2421,16 +2376,25 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [ dependencies = [
"ahash", "ahash 0.7.6",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.3",
] ]
[[package]] [[package]]
name = "hashlink" name = "hashlink"
version = "0.8.1" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" checksum = "0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa"
dependencies = [ dependencies = [
"hashbrown", "hashbrown 0.13.2",
] ]
[[package]] [[package]]
@@ -2514,12 +2478,11 @@ dependencies = [
[[package]] [[package]]
name = "iana-time-zone-haiku" name = "iana-time-zone-haiku"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [ dependencies = [
"cxx", "cc",
"cxx-build",
] ]
[[package]] [[package]]
@@ -2569,7 +2532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown 0.12.3",
] ]
[[package]] [[package]]
@@ -2656,7 +2619,7 @@ dependencies = [
"smol", "smol",
"structopt", "structopt",
"structopt-toml", "structopt-toml",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
] ]
@@ -2695,9 +2658,9 @@ checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.62" version = "0.3.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5" checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@@ -2744,9 +2707,9 @@ dependencies = [
[[package]] [[package]]
name = "libm" name = "libm"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
[[package]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
@@ -2775,19 +2738,10 @@ dependencies = [
"smol", "smol",
"structopt", "structopt",
"structopt-toml", "structopt-toml",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
] ]
[[package]]
name = "link-cplusplus"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.3.7" version = "0.3.7"
@@ -3179,22 +3133,22 @@ dependencies = [
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.0.12" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.0.12" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -3383,9 +3337,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.56" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -3668,24 +3622,27 @@ dependencies = [
[[package]] [[package]]
name = "rkyv" name = "rkyv"
version = "0.7.41" version = "0.7.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21499ed91807f07ae081880aabb2ccc0235e9d88011867d984525e9a4c3cfa3e" checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58"
dependencies = [ dependencies = [
"bitvec",
"bytecheck", "bytecheck",
"hashbrown", "hashbrown 0.12.3",
"indexmap", "indexmap",
"ptr_meta", "ptr_meta",
"rend", "rend",
"rkyv_derive", "rkyv_derive",
"seahash", "seahash",
"tinyvec",
"uuid",
] ]
[[package]] [[package]]
name = "rkyv_derive" name = "rkyv_derive"
version = "0.7.41" version = "0.7.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac1c672430eb41556291981f45ca900a0239ad007242d1cb4b4167af842db666" checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -3812,12 +3769,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "scratch"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
[[package]] [[package]]
name = "sct" name = "sct"
version = "0.7.0" version = "0.7.0"
@@ -3889,7 +3840,7 @@ checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -3905,9 +3856,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.1" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -4095,9 +4046,9 @@ dependencies = [
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.2" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d283f86695ae989d1e18440a943880967156325ba025f05049946bff47bcc2b" checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.48.0", "windows-sys 0.48.0",
@@ -4145,7 +4096,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029"
dependencies = [ dependencies = [
"ahash", "ahash 0.7.6",
"atoi", "atoi",
"bitflags", "bitflags",
"byteorder", "byteorder",
@@ -4324,9 +4275,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.15" version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4400,7 +4351,7 @@ dependencies = [
"structopt", "structopt",
"structopt-toml", "structopt-toml",
"thiserror", "thiserror",
"toml 0.7.3", "toml 0.7.4",
"url", "url",
] ]
@@ -4507,7 +4458,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
@@ -4576,9 +4527,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.7.3" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
@@ -4588,18 +4539,18 @@ dependencies = [
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.1" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.19.8" version = "0.19.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"serde", "serde",
@@ -4628,14 +4579,14 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.30" version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
dependencies = [ dependencies = [
"once_cell", "once_cell",
] ]
@@ -4736,7 +4687,7 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137"
dependencies = [ dependencies = [
"hashbrown", "hashbrown 0.12.3",
"regex", "regex",
] ]
@@ -4807,6 +4758,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "uuid"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
[[package]] [[package]]
name = "value-bag" name = "value-bag"
version = "1.0.0-alpha.9" version = "1.0.0-alpha.9"
@@ -4827,7 +4784,6 @@ dependencies = [
"darkfi", "darkfi",
"darkfi-sdk", "darkfi-sdk",
"indicatif", "indicatif",
"num_cpus",
"rand", "rand",
"rayon", "rayon",
] ]
@@ -4889,9 +4845,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.85" version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4" checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@@ -4899,16 +4855,16 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.85" version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822" checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -4937,9 +4893,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.35" version = "0.4.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163" checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@@ -4949,9 +4905,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.85" version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434" checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@@ -4959,28 +4915,28 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.85" version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869" checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.85" version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb" checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93"
[[package]] [[package]]
name = "wasm-encoder" name = "wasm-encoder"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05d0b6fcd0aeb98adf16e7975331b3c17222aa815148f5b976370ce589d80ef" checksum = "e77053dc709db790691d3732cfc458adc5acc881dec524965c608effdcd9c581"
dependencies = [ dependencies = [
"leb128", "leb128",
] ]
@@ -5152,9 +5108,9 @@ dependencies = [
[[package]] [[package]]
name = "wast" name = "wast"
version = "57.0.0" version = "58.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6eb0f5ed17ac4421193c7477da05892c2edafd67f9639e3c11a82086416662dc" checksum = "372eecae2d10a5091c2005b32377d7ecd6feecdf2c05838056d02d8b4f07c429"
dependencies = [ dependencies = [
"leb128", "leb128",
"memchr", "memchr",
@@ -5164,18 +5120,18 @@ dependencies = [
[[package]] [[package]]
name = "wat" name = "wat"
version = "1.0.63" version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab9ab0d87337c3be2bb6fc5cd331c4ba9fd6bcb4ee85048a0dd59ed9ecf92e53" checksum = "6d47446190e112ab1579ab40b3ad7e319d859d74e5134683f04e9f0747bf4173"
dependencies = [ dependencies = [
"wast", "wast",
] ]
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.62" version = "0.3.63"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721" checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@@ -5259,21 +5215,6 @@ dependencies = [
"windows_x86_64_msvc 0.33.0", "windows_x86_64_msvc 0.33.0",
] ]
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.45.0" version = "0.45.0"
@@ -5476,9 +5417,9 @@ dependencies = [
[[package]] [[package]]
name = "xsalsa20poly1305" name = "xsalsa20poly1305"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "472c385ee974833d7e59979eeb74175d56774be3768b5bcc581337e21396bda3" checksum = "02a6dad357567f81cd78ee75f7c61f1b30bb2fe4390be8fb7c69e2ac8dffb6c7"
dependencies = [ dependencies = [
"aead", "aead",
"poly1305", "poly1305",
@@ -5525,7 +5466,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.15", "syn 2.0.16",
] ]
[[package]] [[package]]

View File

@@ -28,7 +28,6 @@ clap = {version = "4.2.7", features = ["derive"]}
rand = "0.8.5" rand = "0.8.5"
simplelog = "0.12.1" simplelog = "0.12.1"
log = "0.4.17" log = "0.4.17"
num_cpus = "1.15.0"
url = "2.3.1" url = "2.3.1"
thiserror = "1.0.40" thiserror = "1.0.40"

View File

@@ -162,7 +162,7 @@ async fn main() -> DnetViewResult<()> {
let mut dnetview = DnetView::new(model.clone(), view); let mut dnetview = DnetView::new(model.clone(), view);
let parser = DataParser::new(model, config); let parser = DataParser::new(model, config);
let nthreads = num_cpus::get(); let nthreads = std::thread::available_parallelism().unwrap().get();
let (signal, shutdown) = async_channel::unbounded::<()>(); let (signal, shutdown) = async_channel::unbounded::<()>();
let (_, result) = Parallel::new() let (_, result) = Parallel::new()

View File

@@ -15,6 +15,5 @@ ctrlc = "3.2.5"
darkfi = {path = "../../"} darkfi = {path = "../../"}
darkfi-sdk = {path = "../../src/sdk"} darkfi-sdk = {path = "../../src/sdk"}
indicatif = "0.17.3" indicatif = "0.17.3"
num_cpus = "1.15.0"
rand = "0.8.5" rand = "0.8.5"
rayon = "1.7.0" rayon = "1.7.0"

View File

@@ -128,7 +128,11 @@ fn main() {
} }
// Threadpool // Threadpool
let num_threads = if args.threads.is_some() { args.threads.unwrap() } else { num_cpus::get() }; let num_threads = if args.threads.is_some() {
args.threads.unwrap()
} else {
std::thread::available_parallelism().unwrap().get()
};
let rayon_pool = rayon::ThreadPoolBuilder::new().num_threads(num_threads).build().unwrap(); let rayon_pool = rayon::ThreadPoolBuilder::new().num_threads(num_threads).build().unwrap();
// Handle SIGINT // Handle SIGINT

View File

@@ -20,7 +20,7 @@ async fn main() -> Result<()> {
let dchat = Dchat::new(p2p); let dchat = Dchat::new(p2p);
let nthreads = num_cpus::get(); let nthreads = std::thread::available_parallelism().unwrap().get();
let (signal, shutdown) = async_channel::unbounded::<()>(); let (signal, shutdown) = async_channel::unbounded::<()>();
let ex = Arc::new(Executor::new()); let ex = Arc::new(Executor::new());

View File

@@ -13,7 +13,7 @@ async fn main() -> Result<()> {
let ex = Arc::new(Executor::new()); let ex = Arc::new(Executor::new());
let ex2 = ex.clone(); let ex2 = ex.clone();
let nthreads = num_cpus::get(); let nthreads = std::thread::available_parallelism().unwrap().get();
let (signal, shutdown) = smol::channel::unbounded::<()>(); let (signal, shutdown) = smol::channel::unbounded::<()>();
let (_, result) = Parallel::new() let (_, result) = Parallel::new()
@@ -30,9 +30,10 @@ async fn main() -> Result<()> {
} }
``` ```
We get the number of cpu cores using `num_cpus::get()` and spin up a We get the number of cpu cores using
bunch of threads in parallel using `easy_parallel`. Right now it doesn't `std::thread::available_parallelism()` and spin up a bunch of threads
do anything, but soon we'll run dchat inside this block. in parallel using `easy_parallel`. Right now it doesn't do anything,
but soon we'll run dchat inside this block.
**Note**: DarkFi includes a macro called `async_daemonize` that is used by **Note**: DarkFi includes a macro called `async_daemonize` that is used by
DarkFi binaries to minimize boilerplate in the repo. To keep things DarkFi binaries to minimize boilerplate in the repo. To keep things

View File

@@ -19,7 +19,6 @@ async-std = "1.12.0"
async-trait = "0.1.68" async-trait = "0.1.68"
easy-parallel = "3.3.0" easy-parallel = "3.3.0"
smol = "1.3.0" smol = "1.3.0"
num_cpus = "1.15.0"
log = "0.4.17" log = "0.4.17"
simplelog = "0.12.1" simplelog = "0.12.1"

View File

@@ -250,7 +250,7 @@ async fn main() -> Result<()> {
ex.spawn(async move { listen_and_serve(accept_addr.clone(), rpc, _ex).await }).detach(); ex.spawn(async move { listen_and_serve(accept_addr.clone(), rpc, _ex).await }).detach();
// ANCHOR_END: json_init // ANCHOR_END: json_init
let nthreads = num_cpus::get(); let nthreads = std::thread::available_parallelism().unwrap().get();
let (signal, shutdown) = smol::channel::unbounded::<()>(); let (signal, shutdown) = smol::channel::unbounded::<()>();
let (_, result) = Parallel::new() let (_, result) = Parallel::new()

View File

@@ -189,11 +189,12 @@ macro_rules! async_daemonize {
])?; ])?;
// https://docs.rs/smol/latest/smol/struct.Executor.html#examples // https://docs.rs/smol/latest/smol/struct.Executor.html#examples
let n_threads = std::thread::available_parallelism().unwrap().get();
let ex = async_std::sync::Arc::new(smol::Executor::new()); let ex = async_std::sync::Arc::new(smol::Executor::new());
let (signal, shutdown) = smol::channel::unbounded::<()>(); let (signal, shutdown) = smol::channel::unbounded::<()>();
let (_, result) = easy_parallel::Parallel::new() let (_, result) = easy_parallel::Parallel::new()
// Run four executor threads // Run four executor threads
.each(0..4, |_| smol::future::block_on(ex.run(shutdown.recv()))) .each(0..n_threads, |_| smol::future::block_on(ex.run(shutdown.recv())))
// Run the main future on the current thread. // Run the main future on the current thread.
.finish(|| { .finish(|| {
smol::future::block_on(async { smol::future::block_on(async {