Skip to content

Commit 5c2fc1f

Browse files
authored
Slightly optimize masto-id-convert and update (#621)
* slightly optimize and up * rm uuid dev dep * update snapshot * update benches * update docs * add nixos ident
1 parent 6eeb95d commit 5c2fc1f

File tree

9 files changed

+541
-338
lines changed

9 files changed

+541
-338
lines changed

β€ŽCargo.lock

+289-230
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€ŽCargo.toml

+27-30
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ aliri_braid = "0.4.0"
8484
arc-swap = "1.7.1"
8585
argh = "0.1.12"
8686
argon2 = { version = "0.5.3", features = ["std"] }
87-
async-graphql = { version = "7.0.11", default-features = false, features = [
87+
async-graphql = { version = "7.0.13", default-features = false, features = [
8888
"graphiql",
8989
"tempfile",
9090
"time",
9191
"tracing",
9292
"uuid",
9393
] }
94-
async-graphql-axum = "7.0.11"
94+
async-graphql-axum = "7.0.13"
9595
async-trait = "0.1.83"
9696
asynk-strim = "0.1.2"
9797
axum = { version = "0.7.9", features = ["macros", "multipart"] }
@@ -107,16 +107,16 @@ base64-simd = "0.8.0"
107107
blake3 = "1.5.5"
108108
bubble-bath = "0.2.1"
109109
bytes = "1.9.0"
110-
chrono = { version = "0.4.38", default-features = false }
111-
clap = { version = "4.5.21", features = ["derive", "wrap_help"] }
110+
chrono = { version = "0.4.39", default-features = false }
111+
clap = { version = "4.5.23", features = ["derive", "wrap_help"] }
112112
color-eyre = "0.6.3"
113113
colored_json = "5.0.0"
114-
const_format = "0.2.33"
114+
const_format = "0.2.34"
115115
const-oid = { version = "0.9.6", features = ["db"] }
116116
cookie = { version = "0.18.1", features = ["percent-encode"] }
117117
derive_builder = "0.20.2"
118118
derive_more = { version = "1.0.0", features = ["from"] }
119-
diesel = { version = "2.2.5", default-features = false, features = [
119+
diesel = { version = "2.2.6", default-features = false, features = [
120120
"32-column-tables",
121121
"postgres_backend",
122122
"uuid",
@@ -130,13 +130,13 @@ diesel-async = { version = "0.5.2", features = [
130130
] }
131131
diesel_full_text_search = { version = "2.2.0", default-features = false }
132132
diesel_migrations = "2.2.0"
133-
divan = "0.1.16"
133+
divan = "0.1.17"
134134
dotenvy = "0.15.7"
135135
either = { version = "1.13.0", default-features = false }
136136
enum_dispatch = "0.3.13"
137137
envy = "0.4.2"
138138
eyre = "0.6.12"
139-
fred = { version = "10.0.0", features = [
139+
fred = { version = "10.0.1", features = [
140140
"enable-rustls-ring",
141141
"full-tracing",
142142
"i-scripts",
@@ -164,7 +164,7 @@ hickory-resolver = { version = "0.25.0-alpha.4", default-features = false, featu
164164
"native-certs",
165165
"tokio-runtime",
166166
] }
167-
http = "1.1.0"
167+
http = "1.2.0"
168168
http-body = "1.0.1"
169169
http-body-util = "0.1.2"
170170
httpdate = "1.0.3"
@@ -190,7 +190,7 @@ insta = { version = "1.41.1", default-features = false, features = [
190190
"glob",
191191
"json",
192192
] }
193-
iso8601-timestamp = { version = "0.3.1", features = ["diesel-pg"] }
193+
iso8601-timestamp = { version = "0.3.2", features = ["diesel-pg"] }
194194
isolang = { version = "2.4.0", features = [
195195
"english_names",
196196
"list_languages",
@@ -199,7 +199,7 @@ isolang = { version = "2.4.0", features = [
199199
itertools = { version = "0.13.0", default-features = false }
200200
lantern-client-sdk = { package = "client-sdk", git = "https://github.com/Lantern-chat/client-sdk-rs.git", rev = "efb4288d9b107b48609802193d57b29f7ae395a1", default-features = false }
201201
leb128 = "0.2.5"
202-
lettre = { version = "0.11.10", default-features = false, features = [
202+
lettre = { version = "0.11.11", default-features = false, features = [
203203
"builder",
204204
"hostname",
205205
"pool",
@@ -208,9 +208,9 @@ lettre = { version = "0.11.10", default-features = false, features = [
208208
"tokio1-rustls-tls",
209209
"tracing",
210210
] }
211-
lexical-parse-integer = { version = "1.0.2", default-features = false }
212-
logos = "0.14.3"
213-
lol_html = "2.0.0"
211+
lexical-parse-integer = { version = "1.0.5", default-features = false }
212+
logos = "0.15.0"
213+
lol_html = "2.1.0"
214214
meilisearch-sdk = { version = "0.27.1", default-features = false }
215215
memchr = "2.7.4"
216216
miette = { version = "7.4.0", features = ["fancy"] }
@@ -223,9 +223,6 @@ mrml = { version = "4.0.1", default-features = false, features = [
223223
"parse",
224224
"render",
225225
] }
226-
nanorand = { version = "0.7.0", default-features = false, features = [
227-
"wyrand",
228-
] }
229226
notify-debouncer-full = "0.4.0"
230227
num-derive = "0.4.2"
231228
num-traits = "0.2.19"
@@ -272,15 +269,15 @@ quote = "1.0.37"
272269
rand = "0.8.5"
273270
rand_xorshift = "0.3.0"
274271
rayon = "1.10.0"
275-
redb = { version = "2.2.0", features = ["logging"] }
272+
redb = { version = "2.3.0", features = ["logging"] }
276273
regex = "1.11.1"
277274
retry-policies = "0.4.0"
278275
ring = { version = "0.17.8", features = ["std"] }
279276
rsa = "0.9.7"
280277
rstest = { version = "0.23.0", default-features = false }
281278
rust-embed = { version = "8.5.0", features = ["include-exclude"] }
282279
rustc-hash = "2.1.0"
283-
rustls = { version = "0.23.19", default-features = false, features = [
280+
rustls = { version = "0.23.20", default-features = false, features = [
284281
"logging",
285282
"ring",
286283
"std",
@@ -292,10 +289,10 @@ sailfish = { version = "0.9.0", default-features = false, features = [
292289
"derive",
293290
"perf-inline",
294291
] }
295-
schemars = { version = "1.0.0-alpha.16", features = ["semver1"] }
292+
schemars = { version = "1.0.0-alpha.17", features = ["semver1"] }
296293
scoped-futures = { version = "0.1.4", default-features = false }
297294
semver = { version = "1.0.23", features = ["serde"] }
298-
serde = { version = "1.0.215", features = ["derive"] }
295+
serde = { version = "1.0.216", features = ["derive"] }
299296
serde_json = "1.0.133"
300297
serde_test = "1.0.177"
301298
serde_urlencoded = "0.7.1"
@@ -313,14 +310,14 @@ subtle = "2.6.1"
313310
syn = { version = "2.0.90", features = ["full"] }
314311
sync_wrapper = "1.0.2"
315312
tempfile = "3.14.0"
316-
thiserror = "2.0.3"
317-
time = "0.3.36"
318-
tokio = { version = "1.41.1", features = ["full"] }
313+
thiserror = "2.0.6"
314+
time = "0.3.37"
315+
tokio = { version = "1.42.0", features = ["full"] }
319316
tokio-postgres = "0.7.12"
320317
tokio-postgres-rustls = "0.13.0"
321-
tokio-util = { version = "0.7.12", features = ["io", "rt"] }
318+
tokio-util = { version = "0.7.13", features = ["io", "rt"] }
322319
toml = { version = "0.8.19", default-features = false, features = ["parse"] }
323-
tower = { version = "0.5.1", default-features = false, features = ["util"] }
320+
tower = { version = "0.5.2", default-features = false, features = ["util"] }
324321
tower-http = { version = "0.6.2", features = [
325322
"catch-panic",
326323
"cors",
@@ -349,14 +346,14 @@ triomphe = { version = "0.1.14", default-features = false, features = [
349346
typed-builder = "0.20.0"
350347
typetag = "0.2.18"
351348
unsize = "1.1.0"
352-
ureq = "2.11.0"
349+
ureq = "2.12.1"
353350
url = "2.5.4"
354351
urlencoding = "2.1.3"
355352
uuid = { version = "1.11.0", features = ["fast-rng", "v7"] }
356353
uuid-simd = { version = "0.8.0", features = ["uuid"] }
357354
walkdir = "2.5.0"
358-
wasm-encoder = "0.221.0"
359-
wasmparser = "0.221.0"
355+
wasm-encoder = "0.221.2"
356+
wasmparser = "0.221.2"
360357
wasmtime = { version = "27.0.0", default-features = false, features = [
361358
"addr2line",
362359
"async",
@@ -367,7 +364,7 @@ wasmtime = { version = "27.0.0", default-features = false, features = [
367364
"runtime",
368365
] }
369366
wasmtime-wasi = { version = "27.0.0", default-features = false }
370-
wat = "1.221.0"
367+
wat = "1.221.2"
371368
whatlang = "0.16.4"
372369
whichlang = "0.1.0"
373370
wit-bindgen = "0.36.0"

β€Žclippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
doc-valid-idents = [
22
"ActivityPub",
33
"DoS",
4+
"NixOS",
45
"OAuth",
56
"OAuth2",
67
"PostgreSQL",
78
"PubSub",
8-
"WyRand",
99
"gRPC",
1010
]

β€Žlib/masto-id-convert/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ harness = false
1111

1212
[dependencies]
1313
lexical-parse-integer.workspace = true
14-
nanorand.workspace = true
1514
uuid.workspace = true
1615

1716
[dev-dependencies]
1817
divan.workspace = true
1918
time.workspace = true
20-
uuid.workspace = true
2119

2220
[lints]
2321
workspace = true

β€Žlib/masto-id-convert/README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ Convert a Mastodon snowflake ID into a UUID v7 while preserving the timestamp co
44

55
## How?
66

7-
The unix timestamp is preserved as-is, the 2-bytes sequence is stretched out via the WyRand PRNG algorithm.
7+
The unix timestamp is preserved as-is, the 2-bytes sequence is kept as-is since we expect the sequence to be already unique.
88

99
## Performance
1010

11-
Tested inside a WSL2 installation on a Ryzen 5 3600X:
11+
Tested inside a NixOS installation on a Ryzen 7 7840U:
1212

1313
```text
14-
process 110368129515784116
15-
time: [16.675 ns 16.822 ns 17.037 ns]
16-
change: [-1.2226% -0.3915% +0.4911%] (p = 0.37 > 0.05)
14+
Timer precision: 20 ns
15+
process fastest β”‚ slowest β”‚ median β”‚ mean β”‚ samples β”‚ iters
16+
β”œβ”€ process ASCII β”‚ β”‚ β”‚ β”‚ β”‚
17+
β”‚ ╰─ 110368129515784116 20.82 ns β”‚ 192 ns β”‚ 20.98 ns β”‚ 24.25 ns β”‚ 100 β”‚ 12800
18+
╰─ process integer β”‚ β”‚ β”‚ β”‚ β”‚
19+
╰─ 110368129515784116 14.13 ns β”‚ 17.18 ns β”‚ 14.17 ns β”‚ 14.2 ns β”‚ 100 β”‚ 25600
1720
```
1821

19-
Processing a single Mastodon snowflake takes ~17ns
22+
Processing a single Mastodon snowflake takes ~14ns
2023

2124
## License
2225

2326
`masto-id-convert` is licensed under the [MIT license](http://opensource.org/licenses/MIT).
2427

2528
### Contribution
2629

27-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you,
30+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you,
2831
shall be licensed as above, without any additional terms or conditions.

0 commit comments

Comments
Β (0)