Compare commits

...

28 Commits

Author SHA1 Message Date
b20270b869
namer 0.3.2 2024-06-29 12:58:09 +08:00
9a3131b295 fix: mac!! 2024-06-28 01:48:04 +08:00
14a83a8e13
这真是太悲伤了呢.png 2024-06-26 13:00:12 +08:00
c0e36c584a
eval 加点功能 2024-06-25 21:59:38 +08:00
ca3e091826
自己调自己的包可还行 2024-06-25 20:57:45 +08:00
2604213e71
啊? 2024-06-24 15:26:53 +08:00
bc7e5edfc4
加个设置高优先级 2024-06-24 13:18:10 +08:00
d131daed4e
加一些小细节 2024-06-24 12:38:39 +08:00
421ac1a566
update test 2024-06-24 09:18:49 +08:00
5e9a79f868
what 2024-06-24 09:13:43 +08:00
4a221f92fa
ya? 2024-06-24 08:59:32 +08:00
48ce3f281f
啊? 2024-06-24 08:55:30 +08:00
a650b0fb7f
beeeee 2024-06-24 08:52:38 +08:00
96d1be4a52
bench 2024-06-24 02:29:10 +08:00
61887b552a
看来是 0.4T/d( 2024-06-24 02:18:02 +08:00
ac7945e4df
4T/d? 我不信 2024-06-24 02:09:48 +08:00
b2d33bdec5
ruaaa 2024-06-24 02:09:35 +08:00
e68781e80e
fine 2024-06-24 01:29:38 +08:00
69c84f5e30
甚至也许行了 2024-06-24 01:23:56 +08:00
542aba050f
呐呐呐 2024-06-24 00:28:35 +08:00
e49897ee29
好欸 2024-06-24 00:22:26 +08:00
925eec1504
过于逆天 2024-06-23 23:48:13 +08:00
313067ee77
虽然但是,还编译不过呢 2024-06-23 23:18:40 +08:00
903e9f9b4a
慢下来了 2024-06-23 22:11:20 +08:00
42c9c3415b
也是大刀阔斧的重构的一天呢 2024-06-23 21:41:18 +08:00
a958e594a0
先写这么多 2024-06-23 21:19:51 +08:00
a2e5e8b1ae
batch 要来力 2024-06-23 21:08:28 +08:00
06777afc80
我还是回来写单进程 2024-06-23 20:05:57 +08:00
11 changed files with 810 additions and 345 deletions

328
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "addr2line" name = "addr2line"
version = "0.21.0" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
dependencies = [ dependencies = [
"gimli", "gimli",
] ]
@ -61,47 +61,48 @@ dependencies = [
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.13" version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
"anstyle-query", "anstyle-query",
"anstyle-wincon", "anstyle-wincon",
"colorchoice", "colorchoice",
"is_terminal_polyfill",
"utf8parse", "utf8parse",
] ]
[[package]] [[package]]
name = "anstyle" name = "anstyle"
version = "1.0.6" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]] [[package]]
name = "anstyle-parse" name = "anstyle-parse"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [ dependencies = [
"utf8parse", "utf8parse",
] ]
[[package]] [[package]]
name = "anstyle-query" name = "anstyle-query"
version = "1.0.2" 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 = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "3.0.2" version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"windows-sys 0.52.0", "windows-sys 0.52.0",
@ -109,9 +110,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.82" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
dependencies = [ dependencies = [
"backtrace", "backtrace",
] ]
@ -139,20 +140,20 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.2.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.71" version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
dependencies = [ dependencies = [
"addr2line", "addr2line",
"cc", "cc",
@ -222,9 +223,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.15.0" version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
[[package]] [[package]]
name = "bytes" name = "bytes"
@ -234,9 +235,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.95" version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -267,9 +268,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.4" version = "4.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -277,9 +278,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.2" version = "4.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -289,21 +290,21 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.4" version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.7.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
@ -317,9 +318,9 @@ dependencies = [
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]] [[package]]
name = "colored" name = "colored"
@ -400,6 +401,62 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "crossbeam"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
[[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-queue"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.19.0" version = "0.19.0"
@ -407,7 +464,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"libloading 0.8.3", "libloading 0.8.4",
"winapi", "winapi",
] ]
@ -484,7 +541,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -558,7 +615,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -593,9 +650,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.14" version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@ -606,9 +663,9 @@ dependencies = [
[[package]] [[package]]
name = "gimli" name = "gimli"
version = "0.28.1" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
[[package]] [[package]]
name = "gl_generator" name = "gl_generator"
@ -696,9 +753,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.3" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [ dependencies = [
"ahash", "ahash",
"allocator-api2", "allocator-api2",
@ -713,7 +770,7 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"com", "com",
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.4",
"thiserror", "thiserror",
"widestring", "widestring",
"winapi", "winapi",
@ -761,9 +818,9 @@ dependencies = [
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.8.0" version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
@ -773,9 +830,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.28" version = "0.14.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@ -852,6 +909,12 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.11" version = "1.0.11"
@ -880,7 +943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [ dependencies = [
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.4",
"pkg-config", "pkg-config",
] ]
@ -892,15 +955,15 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.153" version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -914,9 +977,9 @@ dependencies = [
[[package]] [[package]]
name = "libloading" name = "libloading"
version = "0.8.3" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.5", "windows-targets 0.52.5",
@ -924,9 +987,9 @@ dependencies = [
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.11" version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"scopeguard", "scopeguard",
@ -949,9 +1012,9 @@ dependencies = [
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.2" version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]] [[package]]
name = "metal" name = "metal"
@ -976,9 +1039,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.2" 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 = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [ dependencies = [
"adler", "adler",
] ]
@ -1054,9 +1117,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.18" version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@ -1092,9 +1155,9 @@ dependencies = [
[[package]] [[package]]
name = "object" name = "object"
version = "0.32.2" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -1119,9 +1182,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" 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 = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [ dependencies = [
"lock_api", "lock_api",
"parking_lot_core", "parking_lot_core",
@ -1129,22 +1192,22 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.9.9" version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
"windows-targets 0.48.5", "windows-targets 0.52.5",
] ]
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.14" version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
@ -1214,9 +1277,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.81" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -1244,24 +1307,24 @@ checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
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 = "8cc3bcbdb1ddfc11e700e62968e6b4cc9c75bb466464ad28fb61c5b2c964418b" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.5.0",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.4" version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -1271,9 +1334,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.6" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -1282,9 +1345,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.3" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]] [[package]]
name = "renderdoc-sys" name = "renderdoc-sys"
@ -1336,9 +1399,9 @@ dependencies = [
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.23" version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
@ -1381,9 +1444,9 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]] [[package]]
name = "schannel" name = "schannel"
@ -1412,11 +1475,11 @@ dependencies = [
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.10.0" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.5.0",
"core-foundation", "core-foundation",
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
@ -1425,9 +1488,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework-sys" name = "security-framework-sys"
version = "2.10.0" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
@ -1435,29 +1498,29 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.198" version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.198" version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.116" version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itoa", "itoa",
@ -1473,7 +1536,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -1520,9 +1583,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.6" version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.52.0",
@ -1586,9 +1649,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.60" version = "2.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1644,22 +1707,22 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.59" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.59" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -1720,9 +1783,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.37.0" version = "1.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -1739,13 +1802,13 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "2.2.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -1784,7 +1847,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]
[[package]] [[package]]
@ -1831,12 +1894,13 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]] [[package]]
name = "tswn" name = "tswn"
version = "0.3.0" version = "0.3.2"
dependencies = [ dependencies = [
"base16384", "base16384",
"chrono", "chrono",
"clap", "clap",
"colored", "colored",
"crossbeam",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"windows-sys 0.48.0", "windows-sys 0.48.0",
@ -1871,9 +1935,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.11" version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
@ -1895,9 +1959,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.0" version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@ -1912,9 +1976,9 @@ checksum = "110352d4e9076c67839003c7788d8604e24dcded13e0b375af3efaa8cf468517"
[[package]] [[package]]
name = "utf8parse" name = "utf8parse"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "valuable" name = "valuable"
@ -1964,7 +2028,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -1998,7 +2062,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -2123,7 +2187,7 @@ dependencies = [
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libc", "libc",
"libloading 0.8.3", "libloading 0.8.4",
"log", "log",
"metal", "metal",
"naga", "naga",
@ -2372,20 +2436,20 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.7.32" version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.7.32" version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.60", "syn 2.0.67",
] ]

View File

@ -1,19 +1,20 @@
[package] [package]
name = "tswn" name = "tswn"
description = "tool shenjack work shop namerena" description = "tool shenjack work shop namerena"
version = "0.3.0" version = "0.3.2"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5", features = ["derive"] }
base16384 = "0.1.0" base16384 = "0.1.0"
tracing = "0.1.40" tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["time"] } tracing-subscriber = { version = "0.3.18", features = ["time"] }
chrono = "0.4" chrono = "0.4"
colored = "2.1.0" colored = "2.1.0"
crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] }
# windows 下额外指定一个 windows 依赖 (微软赛高!) # windows 下额外指定一个 windows 依赖 (微软赛高!)
# 用于在 bench 状态下指定核心(就是闲得) # 用于在 bench 状态下指定核心(就是闲得)
@ -27,3 +28,7 @@ windows-sys = { version = "*", features = [
[features] [features]
default = ["simd"] default = ["simd"]
simd = [] simd = []
[[bin]]
name = "xp2"
path = "./src/xp_eval.rs"

View File

@ -1,5 +1,35 @@
# 还是benchmark # 还是benchmark
## 0.3.0
```text
.\runs\tswn-030.exe --team shenjack -x 5500 --end 1000000000 -t 2 -r 2
2024-06-23T18:23:01.267212Z INFO tswn: 输出文件: "./namerena/namerena-shenjack-2024-06-24_02-23-01.csv"
2024-06-23T18:23:01.267455Z INFO tswn: 开始: 0 结尾: 1000000000 总计: 1000000000
线程数: 2
八围预期: 640
强评/强单最低值: 5500
队伍名: shenjack
时间 batch 大小: 2s
2024-06-23T18:23:01.267605Z INFO tswn: 设置进程亲和性 3 成功 1
2024-06-23T18:23:01.267712Z INFO tswn::cacluate: 开始分发任务(动态 batch)
2024-06-23T18:23:01.267668Z INFO tswn::cacluate: 线程 thread_0 开始计算
2024-06-23T18:23:01.267656Z INFO tswn::cacluate: 线程 thread_1 开始计算
2024-06-23T18:23:01.267817Z INFO tswn: 设置线程亲和性 1 成功 3
2024-06-23T18:23:01.267864Z INFO tswn: 设置线程亲和性 2 成功 3
2024-06-23T18:23:01.286091Z INFO tswn::cacluate: | 1|Id: 20000|476.66E/d 0.02s↑|476.658E/d|0 |0.002% 0:30:12|
2024-06-23T18:23:01.286988Z INFO tswn::cacluate: | 0|Id: 10000|453.50E/d 0.02s↑|930.153E/d|0 |0.112% 0:15:27|
2024-06-23T18:23:03.343359Z INFO tswn::cacluate: | 0|Id: 2173132|441.08E/d 2.06s↓|917.736E/d|0 |0.217% 0:15:39|
2024-06-23T18:23:03.405951Z INFO tswn::cacluate: | 1|Id: 1123374|449.73E/d 2.12s↓|890.812E/d|0 |0.319% 0:16:6|
2024-06-23T18:23:05.358594Z INFO tswn::cacluate: | 0|Id: 3194146|437.83E/d 2.01s↓|887.565E/d|0 |0.424% 0:16:9|
2024-06-23T18:23:05.401429Z INFO tswn::cacluate: | 1|Id: 4235196|450.78E/d 2.00s↑|888.613E/d|0 |0.525% 0:16:7|
2024-06-23T18:23:07.315577Z INFO tswn::cacluate: | 0|Id: 5248694|447.49E/d 1.96s↑|898.267E/d|0 |0.629% 0:15:55|
2024-06-23T18:23:07.392359Z INFO tswn::cacluate: | 1|Id: 6292170|452.87E/d 1.99s↑|900.352E/d|0 |0.733% 0:15:52|
2024-06-23T18:23:09.347710Z INFO tswn::cacluate: | 0|Id: 7328016|440.46E/d 2.03s↓|893.323E/d|0 |0.838% 0:15:59|
```
## before
> --team shenjacka -q 5500 --end 1000000000 --bench > --team shenjacka -q 5500 --end 1000000000 --bench
> >
> 5800x 单核 > 5800x 单核

View File

@ -2,6 +2,12 @@
## 0.3.x ## 0.3.x
### 0.3.1
其实写了一大堆东西了, 就是懒得统计了
现在重写了一遍任务分发机制
然后会在结束的时候统计一下总效率
### 0.3.0 ### 0.3.0
`--bench-core` 改成了 `--core-pick` `--bench-core` 改成了 `--core-pick`
@ -13,6 +19,8 @@
反正现在在我的 5800x 上能跑到 700E/d (单线程) 了 反正现在在我的 5800x 上能跑到 700E/d (单线程) 了
> 我预计在后面加一下多线程运行的时候加个总计效率 > 我预计在后面加一下多线程运行的时候加个总计效率
去掉了 `--bench`
## 0.2.15~16 ## 0.2.15~16
一些提前过滤的东西 一些提前过滤的东西
@ -22,3 +30,19 @@
### 0.1.6~9 ### 0.1.6~9
更新了一大堆核心亲和性相关的东西 更新了一大堆核心亲和性相关的东西
### 0.1.3
> 550E/d
夸张, 比 0.1.1 快了 100E/d
### 0.1.2
优化了一些边界检查, 反正就是没用
`445E/d -> 478E/d`
参考 bench/tswn.md
### 0.1.1
随手发一版

View File

@ -1,13 +1,21 @@
use crate::{ use crate::{
evaluate::NamerEvaluater, evaluate::NamerEvaluater,
name::{Namer, TeamNamer}, name::{Namer, TeamNamer},
Command,
}; };
use std::{io::Write, path::PathBuf}; use std::{
intrinsics::{likely, unlikely},
io::Write,
ops::Range,
path::PathBuf,
time::Instant,
};
use base16384::Base16384Utf8; use base16384::Base16384Utf8;
use colored::Colorize; use colored::Colorize;
use tracing::{info, warn}; use crossbeam::channel::{bounded, Receiver, Sender};
use tracing::{debug, info, warn};
/// 根据 u64 生成对应的 name /// 根据 u64 生成对应的 name
/// 转换成 base 16384 /// 转换成 base 16384
@ -22,109 +30,386 @@ pub fn gen_name(id: u64) -> String {
} }
pub struct CacluateConfig { pub struct CacluateConfig {
/// 开始的 id /// 线程 id
pub start: u64, pub thread_id: u32,
/// 结束的 id
pub end: u64,
/// 线程数 /// 线程数
pub thread_count: u32, pub thread_count: u32,
/// 八围预期值 /// 八围预期值
pub prop_expect: u32, pub prop_expect: u32,
/// qp 预期值 /// qp 预期值
pub qp_expect: u32, pub xp_expect: u32,
/// 队伍名称 /// 队伍名称
pub team: String, pub team: String,
/// 预期状态输出时间间隔 (秒) ///
pub report_interval: u64, pub time_based: bool,
/// 可能的设置指定核心亲和性 /// 可能的设置指定核心亲和性
pub core_affinity: Option<usize>, pub core_affinity: Option<usize>,
/// 输出文件名
pub out_file: PathBuf,
} }
#[inline(always)] pub type WorkInfo = Option<(ThreadId, Range<u64>)>;
pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
// 初始猜测的时间间隔 /// 用于在先成之间共享的运行状态
let mut report_interval = 100000; // 第一次猜测测 10w 次, 获取初始数据 /// 正常状态下是会在多个线程之间共享的
let mut run_speed = 0.0; /// 单线程状态下就直接在主线程里面
let mut start_time = std::time::Instant::now(); /// 用于记录当前各个线程的计算状态
let mut k: u64 = 0; pub struct ComputeStatus {
let mut get_count: u32 = 0; /// 总计算数
// 设置线程亲和性 pub start: u64,
/// 总计算数
pub end: u64,
/// top
pub top_id: u64,
/// 当前各个线程的计算速度
pub thread_speed: Vec<u64>,
/// 当前各个线程是否在运算
pub thread_running: Vec<bool>,
/// 各个线程筛到了几个
pub thread_get_count: Vec<u64>,
}
impl ComputeStatus {
pub fn new(config: &Command) -> Self {
ComputeStatus {
start: config.start,
end: config.end,
top_id: config.start,
thread_speed: vec![0; config.thread_count as usize],
thread_running: vec![false; config.thread_count as usize],
thread_get_count: vec![0; config.thread_count as usize],
}
}
pub fn get_idle_thread(&self) -> Option<usize> { self.thread_running.iter().position(|&x| !x) }
pub fn all_stoped(&self) -> bool { self.thread_running.iter().all(|&x| !x) }
pub fn update_speed(&mut self, thread_id: ThreadId, speed: u64) { self.thread_speed[thread_id as usize] = speed; }
pub fn update_running(&mut self, thread_id: ThreadId, running: bool) { self.thread_running[thread_id as usize] = running; }
pub fn add_get_count(&mut self, thread_id: ThreadId, count: u64) { self.thread_get_count[thread_id as usize] += count; }
pub fn count_speed(&self) -> u64 { self.thread_speed.iter().sum() }
pub fn get_sum_count(&self) -> u64 { self.thread_get_count.iter().sum() }
pub fn predict_time(&self) -> chrono::Duration {
let speed = self.count_speed();
let remain = self.end - self.top_id;
chrono::Duration::milliseconds((remain as f64 / speed as f64 * 1000.0) as i64)
}
}
pub fn start_main(cli_arg: Command, out_path: PathBuf) {
if cli_arg.is_single_thread() {
// 单线程运行的时候也是让他放在主线程跑
let config = cli_arg.as_cacl_config(&out_path);
crate::set_process_cores(config.core_affinity.unwrap());
// cacl(config);
todo!("单线程模式下的调度逻辑没写完呢, 为了保证性能")
} else {
schdule_threads(cli_arg, out_path);
}
}
pub type ThreadId = u32;
/// 描述一下思路吧
///
/// 首先, 本地有几个信息
/// sended: 一个数组, 用于记录每个线程是否已经发送了消息
/// shared_status: 一个共享的状态, 用于记录每个线程的状态
/// threads: 一个线程数组, 用于 hold 住线程
///
/// 其中, shared_status 里面记录了每个线程的状态
/// 里面的 thread_running 用于在分发任务的时候判断是否有线程空闲和哪个线程空闲
///
/// 初始化分发的时候的逻辑如下:
/// 1. 初始化一个 0 大小的 bounded channel
///
/// 分发任务(消息)的时候的逻辑如下:
/// - 如果是 固定大小 的 batch
/// 1. 每次直接发送一个 id 为 -1 (即任意线程都可以接收的) 的消息
/// - 如果是 动态大小 的 batch
/// 0. 等待回返的 request work 的消息
/// 1. 遍历 sended 中 true 的部分, 检查对应 thread_running 是否为 true
/// 2. 如果为 true, 则将对应 sended 置为 false
/// 3. 找到 sended 中 第一个为 false 的线程, 根据 thread_speed 计算出一个合适的 batch
/// 4. 发送一个对应线程 id 的消息
///
/// 最后结尾的时候的逻辑如下:
/// - 如果是 固定大小 的 batch
/// 1.每次发送之前检测是不是快完事了 ( batch size > 剩余 work size )
/// 2.如果是, 则发送剩余的 work, 并且把 ended 置为 true
/// 3.ended 为 true 的时候, 再发送消息的时候直接发送 None
/// - 如果是 动态大小 的 batch
pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
let mut cores = 0;
let mut thread = vec![];
let mut shared_status = ComputeStatus::new(&cli_arg);
let (work_sender, work_receiver) = bounded::<WorkInfo>(0);
let (work_requester, thread_waiter) = bounded::<(ThreadId, u32)>(0);
for i in 0..cli_arg.thread_count {
// 每一个线程
let mut config = cli_arg.as_cacl_config(&out_path);
config.thread_id = i;
let work_receiver = work_receiver.clone();
let work_requester = work_requester.clone();
let shared_status: &mut ComputeStatus = unsafe {
// 直接获取一个共享状态的引用
// 这个对象是可以在多个线程之间共享的
// 但是 rust 不让我这么干
// 所以, unsafe == trust_me
std::mem::transmute::<&mut ComputeStatus, &mut ComputeStatus>(&mut shared_status)
};
config.core_affinity = Some(1 << i);
cores |= 1 << i;
let thread_name = format!("thread_{}", i);
thread.push(std::thread::spawn(move || {
info!("线程 {} 开始计算", thread_name);
cacl(config, shared_status, work_receiver, work_requester);
info!("线程 {} 结束计算", thread_name);
}));
}
crate::set_process_cores(cores);
// 任务分发
// 判断是否所有 work 都分发完了
// 当前分发到的 work 的 最大 index
let full_start_time = Instant::now();
if cli_arg.batch_in_time() {
info!("开始分发任务(动态 batch)");
let mut sended = vec![false; cli_arg.thread_count as usize];
loop {
// 等待一个 request work
// 大部分时间在这里等待
let latest_speed = match thread_waiter.recv() {
Ok(info) => info,
Err(_) => {
// 如果接收到了错误, 则说明所有线程都结束了, 或者怎么着出毛病了
// 退出
break;
}
};
// 遍历 sended 中 true 的部分, 检查对应 thread_running 是否为 true
for (i, sended) in sended.iter_mut().enumerate() {
if *sended {
if shared_status.thread_running[i] {
// 如果为 true, 则将对应 sended 置为 false
*sended = false;
}
}
}
// 根据 latest_speed 计算出一个合适的 batch
if latest_speed.1 == 0 {
// 如果速度为 0, 则说明刚刚开始
// 直接发送一个 1w 的 batch
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..shared_status.top_id + 10000)));
shared_status.top_id += 10000;
} else {
// 计算出一个合适的 batch
let batch = latest_speed.1 as u64 * cli_arg.report_interval.unwrap();
// 判断是否快完事了
// 如果是, 则发送剩余的 work, 然后直接发送 None
if shared_status.top_id + batch > cli_arg.end {
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..cli_arg.end)));
info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end);
loop {
let _ = thread_waiter.try_recv();
let _ = work_sender.try_send(None);
if thread.iter().all(|t| t.is_finished()) {
break;
}
}
break;
} else {
// 如果不是, 则发送一个对应线程 id 的消息
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..shared_status.top_id + batch)));
shared_status.top_id += batch;
}
}
}
} else {
info!("开始分发任务(固定 batch)");
loop {
// 等待一个 request work
// 大部分时间在这里等待
if let Err(_) = thread_waiter.recv() {
// 如果接收到了错误, 则说明所有线程都结束了
// 退出
break;
}
// work 没分发完
// 获取第一个空闲的线程
// 这里不确定是不是会有问题, 先用 unwarp 看看
let thread_id = shared_status.get_idle_thread().unwrap();
// 先检测是否快结束了
if shared_status.top_id + cli_arg.batch_size.unwrap() as u64 >= cli_arg.end {
// 如果快结束了, 则发送剩余的 work 然后发送 None
let _ = work_sender.send(Some((thread_id as u32, shared_status.top_id..cli_arg.end)));
info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end);
loop {
let _ = thread_waiter.try_recv();
let _ = work_sender.try_send(None);
if thread.iter().all(|t| t.is_finished()) {
break;
}
}
break;
} else {
// 如果没有结束, 则发送一个 batch
let _ = work_sender.send(Some((
thread_id as u32,
shared_status.top_id..shared_status.top_id + cli_arg.batch_size.unwrap() as u64,
)));
}
// 更新 top_i
shared_status.top_id += cli_arg.batch_size.unwrap() as u64;
}
}
let full_end_time = Instant::now();
info!("所有任务已完成, 耗时: {:?}", full_end_time - full_start_time);
info!("各个线程获取数量: {:?}", shared_status.thread_get_count);
if shared_status.get_sum_count() != 0 {
info!(
"总计获取: {}, 效率: {}/s",
shared_status.get_sum_count(),
(shared_status.get_sum_count() as f64) / (full_end_time - full_start_time).as_secs_f64()
);
} else {
info!("这真是太悲伤了呢, 干了这么久的活, 一条数据都没获取到");
}
info!("输出文件名: {:?}", out_path);
}
/// 所有的状态输出都在子线程, 也就是这里
///
/// 1. 通过 `Receiver` 获取到主线程的数据
/// 获取到数据后, 开始计算
/// 计算完一个 batch 后, 输出一次状态
/// 这里的状态是在所有运算线程中共享的一个状态
/// 每一个线程运算完一个 batch 后, 都会更新这个状态
/// 输出的时候顺带输出其他线程的状态
pub fn cacl(
config: CacluateConfig,
status: &mut ComputeStatus,
receiver: Receiver<WorkInfo>,
work_sender: Sender<(ThreadId, u32)>,
) {
if let Some(core_affinity) = config.core_affinity { if let Some(core_affinity) = config.core_affinity {
crate::set_thread2core(core_affinity) crate::set_thread2core(core_affinity);
} }
// 提前准备好 team_namer // 提前准备好 team_namer
let team_namer = TeamNamer::new(&config.team).unwrap(); let team_namer = TeamNamer::new(&config.team).unwrap();
let mut main_namer = Namer::new_from_team_namer_unchecked(&team_namer, "dummy"); let mut main_namer = Namer::new_from_team_namer_unchecked(&team_namer, "dummy");
let mut get_count = 0;
for i in (config.start + id..config.end).step_by(config.thread_count as usize) { let mut run_speed = 0.0;
k += 1; // 开始之前, 先发送一个 request
if k >= report_interval { let _ = work_sender.send((config.thread_id, 0));
loop {
// 先 request 一个 work
let work = match receiver.recv() {
Ok(work) => match work {
Some(work) => {
if work.0 == config.thread_id {
work.1
} else {
// 如果不是自己的 work, 则再次发送一个 request
let _ = work_sender.send((config.thread_id, if run_speed == 0.0 { 0 } else { run_speed as u32 }));
// 然后进入下一次循环
continue;
}
}
None => {
// 如果接收到了 None, 则说明活都干完了, 退出
return;
}
},
Err(_) => {
// 如果接收到了错误, 则说明主线程已经结束了, 退出
return;
}
};
// 开始计算
let count = work.end - work.start;
let top = work.end;
let start_time = std::time::Instant::now();
// 计算
let new_get = inner_cacl(&config, work, &mut main_namer, &team_namer);
get_count += new_get;
status.add_get_count(config.thread_id, new_get);
// 完事, 统计
let now = std::time::Instant::now(); let now = std::time::Instant::now();
let d_t: std::time::Duration = now.duration_since(start_time); let d_t: std::time::Duration = now.duration_since(start_time);
let new_run_speed = k as f64 / d_t.as_secs_f64(); let new_run_speed = count as f64 / d_t.as_secs_f64();
// 预估剩余时间 // 预估剩余时间
let wait_time = (config.end - i) / config.thread_count as u64 / new_run_speed as u64; // 先更新自己的状态上去
let wait_time = chrono::Duration::seconds(wait_time as i64); status.update_speed(config.thread_id, new_run_speed as u64);
// 转换成 时:分:秒 // 获取一个全局速度预测
// 根据实际运行速率来调整 report_interval let predict_time = status.predict_time();
report_interval = config.report_interval * new_run_speed as u64; debug!("{:?}", status.thread_speed);
// 输出状态
info!( info!(
"|{:>2}|Id:{:>15}|{:6.2}/s {:>3.3}E/d {:>5.2}{}|{:<3}|预计:{}:{}:{}|", // thread_id, top, 当前线程速度, 当前batch用时, emoji, 全局速度, 全局E/d 速度, 算到几个, 进度, 预计时间
id, "|{:>2}|Id:{:>15}|{:6.2}E/d {:>5.2}s{}|{:>4.3}E/d|{:<3}|{:>2.3}% {}:{}:{:>2}|",
i, config.thread_id,
new_run_speed, top,
new_run_speed * 8.64 / 1_0000.0, new_run_speed * 8.64 / 1_0000.0,
d_t.as_secs_f64(), d_t.as_secs_f64(),
// 根据对比上一段运行速度 输出 emoji // 如果速度差 1k 以上, 则输出emoji
// ⬆️ ➡️ ⬇️ if new_run_speed > run_speed + 1000.0 {
if new_run_speed > run_speed { "".green()
"⬆️".green() } else if new_run_speed < run_speed - 1000.0 {
} else if new_run_speed < run_speed { "".red()
// 橙色
"⬇️".red()
} else { } else {
"➡️".blue() "".blue()
}, },
status.count_speed() as f64 * 8.64 / 1_0000.0,
get_count, get_count,
wait_time.num_hours(), (status.top_id - status.start) as f64 / (status.end - status.start) as f64 * 100.0,
wait_time.num_minutes() % 60, predict_time.num_hours(),
wait_time.num_seconds() % 60 predict_time.num_minutes() % 60,
predict_time.num_seconds() % 60
); );
run_speed = new_run_speed; run_speed = new_run_speed;
start_time = std::time::Instant::now(); // 然后是调度相关
k = 0; status.update_running(config.thread_id, false);
// 请求一个新的 work
let _ = work_sender.send((config.thread_id, if run_speed == 0.0 { 0 } else { run_speed as u32 }));
} }
}
/// 每一个 batch 的具体运算
/// 不负责状态统计
/// 状态统计的最小颗粒度是整个 batch
pub fn inner_cacl(config: &CacluateConfig, range: Range<u64>, main_namer: &mut Namer, team_namer: &TeamNamer) -> u64 {
let mut get_count = 0;
for i in range {
// 这堆操作放在这边了, 保证统计没问题 // 这堆操作放在这边了, 保证统计没问题
let name = gen_name(i); let name = gen_name(i);
// 新加的提前检测 // 新加的提前检测
if !main_namer.replace_name(&team_namer, &name) { if likely(!main_namer.replace_name(&team_namer, &name)) {
continue; continue;
} }
// println!("{} {}", i, name);
let prop = main_namer.get_property(); let prop = main_namer.get_property();
if prop > config.prop_expect as f32 { if unlikely(prop > config.prop_expect as f32) {
let name = gen_name(i); let name = gen_name(i);
let full_name = format!("{}@{}", name, config.team); let full_name = format!("{}@{}", name, config.team);
// 虚评 // 虚评
main_namer.update_skill(); main_namer.update_skill();
let xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer); let xu;
let xu_qd = crate::evaluate::xuping::XuPing2_0_1015_QD::evaluate(&main_namer); let xu_qd = crate::evaluate::xuping::XuPing2_0_1015_QD::evaluate(&main_namer);
if likely((xu_qd as u32) < config.xp_expect) {
if xu < config.qp_expect as f64 || xu_qd < config.qp_expect as f64 { xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
if likely((xu as u32) < config.xp_expect) {
continue; continue;
} }
} else {
xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
}
get_count += 1; get_count += 1;
info!("Id:{:>15}|{}|{:.4}|{:.4}|{}", i, full_name, xu, xu_qd, main_namer.get_info()); info!("Id:{:>15}|{}|{:.4}|{:.4}|{}", i, full_name, xu, xu_qd, main_namer.get_info());
// 写入文件
let write_in = format!( let write_in = format!(
// <full_name>,<id>,<xu>,<xuqd>,<main_namer.get_info()> // <full_name>,<id>,<xu>,<xuqd>,<main_namer.get_info()>
"{},{:>15},{:.4},{:.4},{}\n", "{},{:>15},{:.4},{:.4},{}\n",
full_name, main_namer.get_fullname(),
i, i,
xu, xu,
xu_qd, xu_qd,
@ -135,14 +420,15 @@ pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
match std::fs::OpenOptions::new() match std::fs::OpenOptions::new()
.append(true) .append(true)
.create(true) .create(true)
.open(outfile) .open(&config.out_file)
.and_then(|mut file| file.write(write_in.as_bytes())) .and_then(|mut file| file.write(write_in.as_bytes()))
{ {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
warn!("写入文件<{:?}>失败: {}", outfile, e); warn!("写入文件<{:?}>失败: {}", config.out_file, e);
} }
} }
} }
} }
get_count
} }

View File

@ -4,6 +4,7 @@ pub mod xuping;
use crate::name::Namer; use crate::name::Namer;
/// 评价器 /// 评价器
#[allow(unused)]
pub trait NamerEvaluater { pub trait NamerEvaluater {
const NAME: &'static str; const NAME: &'static str;
const VERSION: &'static str; const VERSION: &'static str;

View File

@ -1,4 +1,6 @@
#![feature(portable_simd)] #![feature(portable_simd)]
#![allow(internal_features)]
#![feature(core_intrinsics)]
#![feature(slice_swap_unchecked)] #![feature(slice_swap_unchecked)]
mod cacluate; mod cacluate;
@ -27,53 +29,80 @@ pub struct Command {
/// 八围预期值 /// 八围预期值
#[arg(long = "prop-expected", short = 'p', default_value_t = 640)] #[arg(long = "prop-expected", short = 'p', default_value_t = 640)]
pub prop_expect: u32, pub prop_expect: u32,
/// qp 预期值 /// xp 预期值
#[arg(long = "qp-expected", short = 'q', default_value_t = 0)] #[arg(long = "xp-expected", short = 'x', default_value_t = 0)]
pub qp_expect: u32, pub xp_expect: u32,
/// 队伍名称 /// 队伍名称
#[arg(long)] #[arg(long)]
pub team: String, pub team: String,
/// 预期状态输出时间间隔 (秒) /// 如果指定, 则根据线程的实时速度*时间为单位作为 batch 大小
#[arg(long, short = 'r', default_value_t = 10)] #[arg(long, short = 'r')]
pub report_interval: u64, pub report_interval: Option<u64>,
/// Windows 下会强制单线程, 且设置线程亲和性为核心 0 /// 如果指定, 则使用固定的数量作为 batch 大小
#[arg(long = "bench", default_value_t = false)] #[arg(long, short = 'b')]
pub bench: bool, pub batch_size: Option<u64>,
/// 单线程模式 / benchmark 模式下的核心亲和性核心号 (从 0 开始) /// 单线程模式模式下的核心亲和性核心号 (从 0 开始)
#[arg(long = "core-pick", default_value_t = 0)] #[arg(long = "core-pick")]
pub pick_core: usize, pub pick_core: Option<usize>,
/// 是否为 debug 模式
#[arg(long, short = 'd')]
pub debug: bool,
} }
impl Command { impl Command {
pub fn as_cacl_config(&self) -> CacluateConfig { pub fn as_cacl_config(&self, path: &PathBuf) -> CacluateConfig {
CacluateConfig { CacluateConfig {
start: self.start, thread_id: 0,
end: self.end,
thread_count: self.thread_count, thread_count: self.thread_count,
prop_expect: self.prop_expect, prop_expect: self.prop_expect,
qp_expect: self.qp_expect, xp_expect: self.xp_expect,
team: self.team.clone(), team: self.team.clone(),
report_interval: self.report_interval, time_based: self.batch_in_time(),
core_affinity: if self.bench { Some(1 << self.pick_core) } else { None }, core_affinity: self.pick_core.map(|x| 1 << x),
} out_file: path.clone(),
} }
} }
pub fn set_thread2core(core: usize) { pub fn is_single_thread(&self) -> bool { self.thread_count == 1 }
pub fn batch_in_time(&self) -> bool { self.report_interval.is_some() }
pub fn batch_in_count(&self) -> bool { self.batch_size.is_some() }
pub fn display_info(&self) -> String {
format!(
"开始: {} 结尾: {} 总计: {}\n线程数: {}\n八围预期: {}\n强评/强单最低值: {}\n队伍名: {}\n{}",
self.start,
self.end,
self.end - self.start,
self.thread_count,
self.prop_expect,
self.xp_expect,
self.team,
if self.batch_in_count() {
format!("固定 batch 大小: {}", self.batch_size.unwrap())
} else {
format!("时间 batch 大小: {}s", self.report_interval.unwrap())
}
)
}
}
pub fn set_thread2core(cores: usize) {
#[cfg(windows)] #[cfg(windows)]
unsafe { unsafe {
use windows_sys::Win32::System::Threading::{GetCurrentThread, SetThreadAffinityMask}; use windows_sys::Win32::System::Threading::{GetCurrentThread, SetThreadAffinityMask};
let thread_id = GetCurrentThread(); let thread_id = GetCurrentThread();
let core_mask = core; let core_mask = cores;
match SetThreadAffinityMask(thread_id, core_mask) { match SetThreadAffinityMask(thread_id, core_mask) {
0 => warn!("设置线程亲和性失败 {}", std::io::Error::last_os_error()), 0 => warn!("设置线程亲和性 {cores} 失败 {}", std::io::Error::last_os_error()),
x => info!("设置线程亲和性成功 {}", x), x => info!("设置线程亲和性 {cores} 成功 {}", x),
} }
} }
#[cfg(unix)] #[cfg(unix)]
{ {
warn!("Linux 下不支持设置线程亲和性 (未实现) {}", core) warn!("Linux 下不支持设置线程亲和性 (未实现) {}", cores)
} }
} }
@ -84,8 +113,8 @@ pub fn set_process_cores(cores: usize) {
let process = GetCurrentProcess(); let process = GetCurrentProcess();
let core_mask = cores; let core_mask = cores;
match SetProcessAffinityMask(process, core_mask) { match SetProcessAffinityMask(process, core_mask) {
0 => warn!("设置进程亲和性失败 {}", std::io::Error::last_os_error()), 0 => warn!("设置进程亲和性 {cores} 失败 {}", std::io::Error::last_os_error()),
x => info!("设置进程亲和性成功 {}", x), x => info!("设置进程亲和性 {cores} 成功 {}", x),
} }
} }
#[cfg(unix)] #[cfg(unix)]
@ -94,15 +123,47 @@ pub fn set_process_cores(cores: usize) {
} }
} }
pub fn set_process_priority_to_high() {
#[cfg(windows)]
unsafe {
use windows_sys::Win32::System::Threading::HIGH_PRIORITY_CLASS;
use windows_sys::Win32::System::Threading::{GetCurrentProcess, SetPriorityClass};
let process = GetCurrentProcess();
match SetPriorityClass(process, HIGH_PRIORITY_CLASS) {
0 => warn!("设置进程优先级为高失败 {}", std::io::Error::last_os_error()),
_ => info!("设置进程优先级为高成功"),
}
}
#[cfg(unix)]
{
warn!("Linux 下不支持设置进程优先级为高 (未实现)")
}
}
fn main() { fn main() {
tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init();
let mut cli_arg = Command::parse(); let mut cli_arg = Command::parse();
tracing_subscriber::fmt()
.with_max_level(if cli_arg.debug {
tracing::Level::DEBUG
} else {
tracing::Level::INFO
})
.init();
// 先验证参数
// batch 至少要是 size 或者 count 之一
if !cli_arg.batch_in_count() && !cli_arg.batch_in_time() {
warn!("必须指定 batch 大小, 请使用 -r 或者 -b 选项");
return;
}
// 如果俩都指定了, 则使用时间为准
if cli_arg.batch_in_count() && cli_arg.batch_in_time() {
warn!("两个 batch 选项都指定了, 将使用时间为准");
}
// 将数据量处理成可被 thread_count 整除 // 将数据量处理成可被 thread_count 整除
let left = cli_arg.start % cli_arg.thread_count as u64; let left = cli_arg.start % cli_arg.thread_count as u64;
cli_arg.end = cli_arg.end.wrapping_add(left); cli_arg.end = cli_arg.end.wrapping_add(left);
let mut threads = vec![];
let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S").to_string(); let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S").to_string();
// namerena-<team>-<time>.csv // namerena-<team>-<time>.csv
// <time>: %Y-%m-%d-%H-%M-%S // <time>: %Y-%m-%d-%H-%M-%S
@ -112,52 +173,10 @@ fn main() {
// 先创建文件夹 // 先创建文件夹
if let Err(e) = std::fs::create_dir_all(out_path.parent().unwrap()) { if let Err(e) = std::fs::create_dir_all(out_path.parent().unwrap()) {
warn!("创建文件夹失败: {}", e); warn!("创建文件夹失败: {}", e);
return;
} }
info!("开始: {} 结尾: {}", cli_arg.start, cli_arg.end); info!("{}", cli_arg.display_info());
info!("线程数: {}", cli_arg.thread_count); set_process_priority_to_high();
info!("八围预期: {}", cli_arg.prop_expect); cacluate::start_main(cli_arg, out_path);
info!("队伍名: {}", cli_arg.team);
info!("输出文件名: {:?}", out_path);
info!("预期状态输出时间间隔: {} 秒", cli_arg.report_interval);
info!("是否启动 benchmark 模式: {}", cli_arg.bench);
if cli_arg.bench {
info!("开始 benchmark");
cli_arg.thread_count = 1;
let mut config = cli_arg.as_cacl_config();
config.core_affinity = Some(1 << cli_arg.pick_core);
set_process_cores(config.core_affinity.unwrap());
cacluate::cacl(config, 1, &out_path);
} else {
let mut n = 0;
let mut cores = 0;
if cli_arg.thread_count == 1 {
// 单线程运行的时候也是让他放在主线程跑
let mut config = cli_arg.as_cacl_config();
config.core_affinity = Some(1 << cli_arg.pick_core);
set_process_cores(config.core_affinity.unwrap());
cacluate::cacl(config, 1, &out_path);
} else {
for i in 0..cli_arg.thread_count {
n += 1;
let mut config = cli_arg.as_cacl_config();
// 核心亲和性: n, n+1
config.core_affinity = Some(1 << i);
cores |= 1 << i;
let out_path = out_path.clone();
let thread_name = format!("thread_{}", n);
threads.push(std::thread::spawn(move || {
info!("线程 {} 开始计算", thread_name);
cacluate::cacl(config, n, &out_path);
info!("线程 {} 结束计算", thread_name);
}));
}
set_process_cores(cores);
}
}
for t in threads {
t.join().unwrap();
}
} }

View File

@ -453,7 +453,6 @@ impl Namer {
+ *prop_name.get_unchecked(6) as u32; + *prop_name.get_unchecked(6) as u32;
full += self.name_prop.get_unchecked(0) / 3 + 154; full += self.name_prop.get_unchecked(0) / 3 + 154;
if full < 380 { if full < 380 {
println!("name_prop[0] < 380 {}", self.name);
return false; return false;
} }
} }
@ -494,35 +493,6 @@ impl Namer {
} }
} }
} }
// let mut simd_val = self.val;
// let mut simd_val_b = self.val;
// let simd_181 = u8x32::splat(181);
// let simd_199 = u8x32::splat(199);
// let simd_128 = u8x32::splat(128);
// let simd_53 = u8x32::splat(53);
// let simd_63 = u8x32::splat(63);
// let simd_32 = u8x32::splat(32);
// for i in (0..256).step_by(32) {
// unsafe {
// let mut x = u8x32::from_slice(simd_val.get_unchecked(i..));
// let mut y = u8x32::from_slice(simd_val_b.get_unchecked(i..));
// x = (x * simd_181 + simd_199) & simd_128;
// y = (y * simd_53) & simd_63 ^ simd_32;
// x.copy_to_slice(simd_val.get_unchecked_mut(i..));
// y.copy_to_slice(simd_val_b.get_unchecked_mut(i..));
// }
// }
// let mut mod_count = 0;
// for i in 0..256 {
// unsafe {
// if simd_val.get_unchecked(i) != &0 {
// *self.name_base.get_unchecked_mut(mod_count as usize) = *simd_val_b.get_unchecked(i);
// mod_count += 1;
// }
// }
// }
// const int N = 256, M = 128, K = 64, skill_cnt = 40, max_len = 25; // const int N = 256, M = 128, K = 64, skill_cnt = 40, max_len = 25;
let mut a: u8 = 0; let mut a: u8 = 0;
let mut b: u8 = 0; let mut b: u8 = 0;
@ -563,26 +533,65 @@ impl Namer {
unsafe { unsafe {
if p > 10 && *self.skl_id.get_unchecked(j) < 35 { if p > 10 && *self.skl_id.get_unchecked(j) < 35 {
*self.skl_freq.get_unchecked_mut(j) = p - 10; *self.skl_freq.get_unchecked_mut(j) = p - 10;
if *self.skl_id.get_unchecked(j) < 25 { if p < 35 {
last = j as i32; last = j as i8;
} }
} else { } else {
*self.skl_freq.get_unchecked_mut(j) = 0; *self.skl_freq.get_unchecked_mut(j) = 0;
} }
} }
} }
if last != -1 { match last {
// self.skl_freq[last as usize] <<= 1; -1 => unsafe {
unsafe { // 判断 14, 15 去
*self.skl_freq.get_unchecked_mut(last as usize) <<= 1; if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
} }
// *= 2 if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
} }
if (self.skl_freq[14] != 0) && (last != 14) { },
self.skl_freq[14] += min(min(self.name_base[60], self.name_base[61]), self.skl_freq[14]); 14 => unsafe {
// 判断 15
*self.skl_freq.get_unchecked_mut(14) <<= 1;
if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
} }
if (self.skl_freq[15] != 0) && (last != 15) { },
self.skl_freq[15] += min(min(self.name_base[62], self.name_base[63]), self.skl_freq[15]); 15 => unsafe {
// 判断 14
*self.skl_freq.get_unchecked_mut(15) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
}
},
x => unsafe {
*self.skl_freq.get_unchecked_mut(x as usize) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
}
if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
}
},
} }
} }
@ -678,11 +687,7 @@ impl Namer {
} }
pub fn get_fullname(&self) -> String { pub fn get_fullname(&self) -> String {
if self.team.is_empty() { format!("{}@{}", self.name, if self.team.is_empty() { &self.name } else { &self.team })
self.name.clone()
} else {
format!("{}@{}", self.name, self.team)
}
} }
} }
@ -792,10 +797,10 @@ mod test {
fn update_name_test() { fn update_name_test() {
// 先创建一个正常的 namer // 先创建一个正常的 namer
// 然后更新名字 // 然后更新名字
let team = TeamNamer::new_unchecked("x"); let team = TeamNamer::new_unchecked("shenjack");
let mut namer = Namer::new_from_team_namer_unchecked(&team, "x"); let mut namer = Namer::new_from_team_namer_unchecked(&team, "x");
let update_name = "k"; let update_name = "一一一丑堀㴁";
namer.replace_name(&team, update_name); namer.replace_name(&team, update_name);
let mut none_update_name = Namer::new_from_team_namer_unchecked(&team, update_name); let mut none_update_name = Namer::new_from_team_namer_unchecked(&team, update_name);

39
miner/src/xp_eval.rs Normal file
View File

@ -0,0 +1,39 @@
#![feature(portable_simd)]
#![feature(slice_swap_unchecked)]
#![allow(internal_features)]
#![feature(core_intrinsics)]
mod evaluate;
mod name;
use std::env;
use evaluate::NamerEvaluater;
fn main() {
// 获取 cli 参数
let arg = env::args().nth(1).expect("need a name to evaluate");
if arg == "-f" {
let arg = env::args().nth(2).expect("need a file to evaluate");
let file = std::fs::read_to_string(arg).expect("file not found");
let names = file.lines().collect::<Vec<_>>();
for name in names {
let mut name = name::Namer::new(&name.to_string()).expect("your name have some thing wrong");
name.update_skill();
let xu = evaluate::xuping::XuPing2_0_1015::evaluate(&name);
let xd = evaluate::xuping::XuPing2_0_1015_QD::evaluate(&name);
println!("{xu}|{xd}")
}
return;
} else if arg == "-h" {
println!("Usage: xp_eval [name]");
println!(" xp_eval -f [file]");
return;
}
let mut name = name::Namer::new(&arg).expect("your name have some thing wrong");
name.update_skill();
let xu = evaluate::xuping::XuPing2_0_1015::evaluate(&name);
let xd = evaluate::xuping::XuPing2_0_1015_QD::evaluate(&name);
println!("{xu}\n{xd}")
}

16
news.md
View File

@ -1,19 +1,3 @@
# 各种"新闻" # 各种"新闻"
## tswn ## tswn
### 0.1.3
> 550E/d
夸张, 比 0.1.1 快了 100E/d
### 0.1.2
优化了一些边界检查, 反正就是没用
`445E/d -> 478E/d`
参考 bench/tswn.md
### 0.1.1
随手发一版

8
train/core_data.toml Normal file
View File

@ -0,0 +1,8 @@
model_version = "0.0.0"
# 整体逻辑
#
# 八围(8) + 技能(35) + 血祭/分身/幻术/亡灵 技能最大值的八围(8)
# == 51
# 每个数来回乘一遍 == 51*51 == 2601
# 参数 = 2601
# 也就是 本名 / ?summon / ?zombie / ?shadow